# Calculate standard deviation from sample size, mean, and confidence interval?

I wonder if I can back calculate standard deviation from mean, sample size, and confidence interval.

For example: mean age = 40.2; sample size = 427; and 95% confidence interval = (38.9-41.5)

And if so, can it be apply to percentage measure, for example: percent being male = 64.2%; sample size = 427; and 95% confidence interval = (59.4-68.7).

• If you are assuming a normal distribution then the formula for the endpoints of the confidence interval is strictly a function of the sample standard deviation. The other variables mean and sample size are given. I don't know what you mean by "percentage measure". So I can't help you with that. – Michael R. Chernick Jan 2 '18 at 1:11
• By Percentage measure I simply meant the 64.2% of sample being male. – KubiK888 Jan 2 '18 at 4:00

• The standard deviation for percentage/proportion is:
\begin{align} \sigma &= \sqrt{p(1-p)} \\[5pt] &= \sqrt{0.642(1-0.642)} \\[5pt] &= 0.4792 \end{align} Thus when given a percentage, you can directly find the std deviation.

• For back tracking, we know, $$CI = p \pm z \frac{\sigma}{\sqrt{N}}$$

For 95%, $$z = 1.96$$, N = 427, $$p=0.642$$

$$\sigma = ?$$

Thus use the above formula and back substitute.

• If your sample size is less than 30 (N<30), you have to use a t-value instead of Z-value (t-value calculator). The t-value has degrees of freedom $$df = N-1$$ and $${\rm prob} = (1-\alpha)/2$$.

Thus the formula is: $$CI = p \pm t_{(N-1)} \frac{\sigma}{\sqrt{N}}$$

• This method uses the central limit theorem and so is only accurate in the limit of large $N$. – Moss Murderer Jan 2 '18 at 1:51
• You are correct, I gave the formula since the question had large sample size > 30. So the CLT is already into effect. For smaller sample size we can use the T-distribution instead of the Z distribution with appropriate degree of freedom. – user3808268 Jan 2 '18 at 2:17
• $\sigma = \sqrt(p∗(1−p))$ is applicable to Bernoulli distribution only, not applicable to other distributions. – user295357 Aug 31 at 16:32

A bit late to the party, but I noticed that the second part of the question was not fully addressed - "can it be apply to percentage measure"?

Following the OPs comment, I am assuming that by "percentage measure" we are referring to some binary outcome (Male/Female, Right handed/Left handed etc.).

In that case the variables are described by a discrete probability distribution, whereas the age is a continuous variable and is described by a continuous probability distribution. A common choice for the distribution of binary variables is the binomial distribution. Confidence intervals for the binomial can be constructed in different ways (wiki). The original study should have described how they derived those confidence intervals.

Note that you can still use the formula provided by user3808268 to get the "standard deviation", but it would be difficult to meaningfully interpret it.

From the description you provided, your first question is about the distribution of people's age. Normal (i.e. Gaussian) distribution applies to such kind of applications.

It will be helpful if you know how the confidence interval (CI) was calculated, because there are many different possible ways that the CI was calculated. For instance, if the distribution is of normal distribution, and the CI was calculated using t-test, then the SD can be estimated with following equation:

SD = sqrt(n)*(ci_upper - ci_lower)/(2 * tinv((1-CL)/2; n-1)),

where CL is the confidence level, ‘ci_upper’ and ‘ci_lower’ are the upper and lower limits of CI respectively, and 'tinv()' is the inverse of Student's T cdf.

Otherwise, if it is of normal distribution, but a known SD was used in calculating CI, then the SD can be calculated with following equation:

SD = sqrt(n)*(ci_upper - ci_lower)/(sqrt(8) * erfinv(CL)),

where 'erfinv ()' is the inverse error function.

Your second question is about the distribution of people's sex (i.e. male or female). From the data you provided, it sounds that there are k=274 males among n=427 of whole samples. Bernoulli distribution applies to this application. In this case, the variance (of male's population) = p*(1-p) = 0.2299, and SD = sqrt(0.2299) = 0.4795, where p is the mean value. Note that "valiance = mean*(1-mean)" is applicable to Bernoulli distribution only.