4
$\begingroup$

How can I calculate the sample mean and sample standard deviation, given that I know the sample size and the confidence interval for the mean?

For example, with the info provided below:

  • Sample size = 300
  • 95% confidence interval of 5.18 < μ < 5.38
$\endgroup$

1 Answer 1

7
$\begingroup$

Obviously you will need to know the type of confidence interval you are dealing with, but let's suppose that this is a standard one-sample confidence interval for the mean, using the standard T-statistic as the pivotal quantity. In that case, the formula for the interval is:

$$\text{CI}(1-\alpha) = \Bigg[ \bar{x} \pm \frac{t_{n-1, \alpha/2}}{\sqrt{n}} \cdot s \Bigg].$$

Thus, if we denote the known lower and upper bounds of the interval as $l$ and $u$ respectively, then you can algebraically reverse-engineer the sample mean and sample standard deviation as:

$$\bar{x} = \frac{l+u}{2} \quad \quad \quad \quad \quad s = \frac{u-l}{2} \cdot \frac{\sqrt{n}}{t_{n-1, \alpha/2}}.$$

With the values specified in your example, you get:

#Set preliminary values
l     <- 5.18;
u     <- 5.38;
n     <- 300;
alpha <- 0.05;

#Compute sample mean and SD
crit <- qt(alpha/2, df = n-1, lower.tail = FALSE);
MEAN <- (l+u)/2;
SD   <- (u-l)*sqrt(n)/(2*crit);

#Print the values
MEAN;
[1] 5.28
SD;
[1] 0.8801386

Thus, assuming that your interval was a standard one-sample confidence interval, you must have had a sample mean $\bar{x} = 5.28$ and sample standard deviation $s = 0.88$.

$\endgroup$
1
  • $\begingroup$ That is fantastic thank you! That pretty much all makes sense $\endgroup$
    – bt75alfa
    Commented Oct 6, 2019 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.