# Calculate standard deviation given mean and percentage

Some values have a normal distribution with mean .0276. What standard deviation is required so that 98% of values are between .0275 and .0278?

What I'm confused with is how to calculate the standard deviation when Z is between two intervals. I know that P(-.0001/σ < Z < .0002/σ) = .98, but I don't know where to go from here.

• Perhaps needs a self-study tag? – mkt - Reinstate Monica Apr 14 '18 at 11:00

We can solve this problem almost instantly in our heads using the "68-95-99.7" rule. I will explain the process in detail because that is what matters. The answer is of little interest: the point to this question is to help us learn to think about probability distributions.

These numbers in the 68-95-99.7 rule are (approximately) the percent chances that a Normal variable lies within one, two, and three standard deviations of its mean. By subtracting these numbers from 100% it follows that the chances of a Normal variable lying beyond one, two, and three SDs of its mean are about 32, 5, and 0.3 percent, respectively. Since this distribution is symmetric, we can split each of these numbers in half to find the chances of lying beyond one, two, and three SDs of the mean in a given direction: the values are about 16, 2.5, and 0.15 percent, respectively. (Slightly more accurate values are shown in the figure.)

The figure uses areas to represent chances. The leftmost value of 16%, for instance, is the proportion of all the area under the curve that lies to the left of -1. The "tail areas" associated with the numbers $$Z = -3,-2,-1, 1,2,3$$ are labeled. (These areas overlap; for instance, the 16% values include regions accounted for by the 2.3% and 0.13% values.)

People who think effectively about probabilities use mental figures like this one.

Turn to the data in the question: 0.0275 is 0.0001 to the left of the mean of 0.0276 while 0.0278 is 0.0002 to the right of the mean: twice as far. We therefore need to enclose 98% of the probability between an unknown number of standard deviations to the left of the mean--call this multiple $$-Z$$ to indicate it's to the left--and twice that number of standard deviations to the right of the mean, which therefore is $$2Z.$$

Equivalently, 100 - 98 = 2% of the probability must lie beyond this range. The figure shows 2.3% of the probability lies to the left of $$-Z=-2$$ and essentially 0% lies to the right of $$Z=2\times 2=4,$$ so $$Z=2$$ would be an accurate guess (albeit a tad low).

The only arithmetic needed to get to this point involved subtractions, one division (of 0.0002 / 0.0001) and halving.

If you would like to get a little closer to "the" answer, look up (or compute) the value of $$Z$$ for which 2% of the probability is to the left of $$-Z$$: that's $$Z=2.054.$$ It's still the case that essentially 0% is to the right of $$2Z \approx 4.1.$$ (Because there actually is a tiny bit of probability beyond $$4.1,$$ the correct value of $$Z$$ must be just a tiny bit more than $$2.054.$$)

Either way, we come up with the result that $$Z$$ is somewhere around $$2$$ or $$2.054.$$

Finally, return to the data in the problem: $$Z$$ standard deviations equals $$0.0001$$ (or $$2Z$$ standard deviations equals $$0.0002:$$ it's all the same). Our answers therefore are

• Quick and dirty, based on the 68-95-99.7 rule: $$0.0001/2 = 0.00005.$$

• A little more refined, based on a table lookup: $$0.0001/2.054 \approx 0.0000486\,91.$$

We know both of these answers will be a little too large, but the second must be quite accurate.

Having gone through this thought process, we could write down the following R commands immediately because they directly carry out the calculation (albeit more accurately):

(Z <- uniroot(function(z) pnorm(2*z)-pnorm(-z) - 0.98, c(2,3))$root)  2.054 158 That agrees with the three decimal digit table I used to get $$2.054.$$ (0.0276 - 0.0275) / Z  4.86 8176e-05 It agrees with our first answer almost to two significant figures and with the second answer almost to four significant figures--more than we really deserve. • Nice answer! Though I'm a bit salty that in the end, the result is "calculate it numerically / use a look-up table", which is what I've been saying 3 years ago and which earned me nothing but downvotes. That's not your fault though and your answer is definitely much better and more comprehensive than mine. – PoorYorick Dec 19 '19 at 8:27 • @Poor I am sympathetic, having been in a similar position several times. I'm pretty sure your answer here has an upvote, though :-). – whuber Dec 19 '19 at 15:01 So you can use R to get the answer: target=function (sd){ b=pnorm(0.0278, mean = 0.0276, sd = sd) a=pnorm(0.0275, mean = 0.0276, sd = sd) return(abs(b-a-0.98)) } sd=optim(1,target) sd$par


This gives:

> sd$par [1] 4.868167e-05  What we are doing is using numerical method to calculate $$\sigma$$ such that $$F(0.0278)-F(0.0275)=0.98$$ where $$F()$$ is cdf for $$N(0.0276,\sigma)$$ It has to be solved numerically. Here is a solution in R using a simple root finding algorithm. We simply solve the equation $$F_{\mu,\sigma}(b) - F_{\mu,\sigma}(a) - p = 0$$ where $$F_{\mu,\sigma}(\cdot)$$ denotes the cumulative distribution function of the normal distribution with mean $$\mu$$ and standard deviation $$\sigma$$. $$b$$ and $$a$$ (with $$b>a$$) are the upper and lower bounds, respectively and $$p$$ ($$0) is the proportion of values that lies between $$a$$ and $$b$$. The function find_sigma is very generic: It accepts fixed arguments for $$a$$, $$b$$, $$\mu$$ and $$p$$. find_sigma <- function(sigma, a, b, mu, prop) { (pnorm(b, mean = mu, sd = sigma) - pnorm(a, mean = mu, sd = sigma)) - prop } uniroot( find_sigma , lower = .Machine$double.xmin
, upper = 1
, a = 0.0275  # lower bound
, b = 0.0278  # upper bound
, mu = 0.0276 # mean
, prop = 0.98 # proportion between a and b
, maxiter = 10000
, tol = 1e-20
# , extendInt = "yes"
)

$root [1] 4.868168e-05  The standard deviation is $$0.000048682$$ as the other answers have found. There is no simple way to calculate this, I believe. I'd suggest looking into numerical solutions for it. Just to explain a bit, this is the normal distribution:$f(x|\sigma, \mu)=\frac{1}{\sqrt{2\pi}\sigma}e^{-\frac{(x-\mu)^2}{2\sigma^2}}$The percentage of values in the interval [a, b] is then given by:$F(a, b)=\int_a^b \! f(x|\sigma, \mu)dx = \int_{-\infty}^b \! f(x|\sigma, \mu)dx - \int_{-\infty}^a \! f(x|\sigma, \mu)dx$You know F(a,b), you know a and b, and you know the mean$\mu$. What you need to do is to solve this equation for$\sigma$. However, the integral is the error function, you cannot solve it analytically, so you can't solve for$\sigma$. Using a numerical approach, it gets easier - for example, you could calculate the normal distribution with a fixed$\sigma$for 1000 x values, calculate the area between a and b, and then iteratively change$\sigma$until you find the value that comes closest to 0.98. There are also functions in most programming languages that calculate the cumulative normal distribution for given parameters, so if you want higher precision, you could use those (again with iterations of$\sigma\$).

• Since I'm being downvoted, I assume that there's some mistake in my explanation. I'd appreciate it if someone could point it out to me! Maybe I've missed something obvious. – PoorYorick Oct 27 '16 at 12:55

I entered on WolframAlpha:

integral_0.0275^0.0278 (1/sqrt(2 π))/a exp(-(((x - 0.0276)/sqrt(2))/a)^2) dx = 0.98


Which got me

0.5 erf(0.0000707107/a) + 0.5 erf(0.000141421/a) = 0.98


Solving which assuming a is real.

gives a = 0.0000486817

Multiple expansions of error function are listed on its Wikipedia page and on math.SE but they are not very useful accurate for hand calculations.

This answers the OP, it has been edited since it was posted, so that this answer no longer applies. $$.0275=.0276-2*\sigma$$ $$.0278=.0276+2*\sigma$$ The 2 comes from the fact the under a normal curve ~98% (97.5%) of the values are found within ~2(1.96) standard deviations of the mean. One just needs to solve for $$\sigma$$ and use the largest value, insuring that 98% is inclusive, as the answer.

So therefore a standard deviation of .0001 is required.

• This fails to take account of the fact that (a) the OP's interval is not symmetric about the mean (b) 1.96 cuts off 2.5% in each tail, not in total. – mdewey Apr 20 '17 at 12:34
• Although you claim the question has been edited, the record shows no evidence of that. We have access to a complete history of all changes to the question, answers, and comments, as well as to all flags and other relevant events. – whuber Jan 12 at 16:30
• @whuber if you notice, the answer I gave is focused on where the 2 comes from. The OP asked about this specifically, that is why I answered the question as I did. Not sure what record you are looking at, but I can tell you with certainty, that the question as it is posed now is not how it was posed when I answered it. Please delete this answer as it serves no useful purpose. – grldsndrs Jan 12 at 21:52
• Your certainty is contradicted by the evidence, but please feel free to delete this post if you wish to remove it. – whuber Jan 13 at 12:23