How do I calculate the margin of error for a mean in R, knowing the sample standard deviation and sample size?

Question

Grade: Education Subject: Support
How do I calculate the margin of error for a mean in R, knowing the sample standard deviation and sample size?
Asked by:
110 Viewed 110 Answers

Answer (110)

Best Answer
(408)
For a sample mean, you'll use the t-distribution instead of the z-distribution. The formula is: MOE = t * (s / sqrt(n)), where 't' is the t-score with (n-1) degrees of freedom at the desired confidence level, 's' is the sample standard deviation, and 'n' is the sample size. You'll need to find the appropriate t-score using `qt()` in R. Example: `qt(0.95, df = n - 1)`. Then combine with the other values.