Question
How do I calculate the margin of error for a mean in R, knowing the sample standard deviation and sample size?
Asked by: USER1289
110 Viewed
110 Answers
Answer (110)
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.