I have the mean value and my question is: is it possible to calculate the standard deviation assuming a normal distribution? Looking at previous questions which have been asked, this question is different from other the variants about how to calculate a standard deviation. Thanks.
-
1$\begingroup$ It is not clear what do you mean... Do you have only the mean? If yes, then the answer is: no. $\endgroup$– Tim ♦Feb 24, 2017 at 14:52
-
$\begingroup$ As indicated, there is a mean plus three probabilities within the specified ranges from the mean. $\endgroup$– Farmer GeorgeFeb 24, 2017 at 16:14
-
1$\begingroup$ It might be better to link to some of the previous questions to which you refer and say why you think they do not apply to your scientific problem. $\endgroup$– mdeweyFeb 24, 2017 at 16:46
1 Answer
My understanding of the question is that you have the following pieces of information. Notation $\mu, w_1, w_2, w_3$ give the mean and some distance from the mean, respectively. You also have $$\mathbb{P}(x\in [\mu\pm w_1]) = p_1$$ $$\mathbb{P}(x\in [\mu\pm w_2]) = p_3$$ $$\mathbb{P}(x\in [\mu\pm w_3]) = p_3$$
Any one of those equations is sufficient: we're interested in finding the zero of $g(\sigma)=\mathbb{P}(x\in [\mu\pm w_1]) - p_1$ for the standard deviation $\sigma$.
If we assume the normal distribution, as you do in your question, then we just need to know the probability $\mathbb{P}(x\in [\mu\pm w_1])$ which is obviously given by the CDF $F$:
$$g(\sigma) = F(\sigma;\mu+w_1)-F(\sigma;\mu-w_1) - p_1 = 0 $$
where the parameter under inference is $\sigma$. Root finding might work. It might be easier to work on the log scale to avoid $\sigma \le 0$.
The only real challenge with this approach is what to do when each of the three equations gives you a different estimate of $\sigma$, or whether the normal model is reasonable at all.
set.seed(13)
x <- rnorm(10000, 5, 2)
x_mean <- mean(x)
p_est <- length(x[x > -1 & x < 1])/length(x)
G <- function(sigma, mu=x_mean, p=p_est){
pnorm(1, mean=mu, sd=sigma)-pnorm(-1, mean=mu, sd=sigma)-p_est
}
sigma <- seq(0.5, 3.5, 0.1)
plot(sigma, G(sigma), ylab=expression(G(sigma)), xlab=expression(sigma), type="l")
abline(h=0, col="grey")
uniroot(G, interval = c(0.5, 3.5))
$root
[1] 1.988266
$f.root
[1] -1.201178e-07
$iter
[1] 7
$init.it
[1] NA
$estim.prec
[1] 6.103516e-05
This plot gives a notional idea of what's going on: uniroot
is searching for where the function crosses $g(\sigma)=0$. Clearly, the function crosses very close to where the true value of $\sigma$ is known to be. More information can be found in its documentation and any numerical analysis textbook.
-
$\begingroup$ Thanks Sycorax. I'm not familiar with root finding. Also, just taking one of the equations, say the first one, would the σ be unique as would there may be an infinity of sigmas (and w1's say) which could provide the same probabilities? Perhaps I mis-understand or miss the point. $\endgroup$ Feb 24, 2017 at 16:23
-
$\begingroup$ w.l.o.g. consider a standard normal distribution. 68% of the data are within $\mu\pm1$. Your problem is inverted: you know $p$% are within $w$ of the mean and want to find $\sigma$. With the information you have, it's not clear to me why there would be more than 1 answer. $\endgroup$– Sycorax ♦Feb 24, 2017 at 16:58
-
$\begingroup$ Ok, think that makes sense. In solving expressions with F(.) I need to explicity write out the normal CDF's? $\endgroup$ Feb 24, 2017 at 18:05
-
$\begingroup$ Ok, will see if I can do it in R - although I'm new to R. $\endgroup$ Feb 24, 2017 at 18:13
-
$\begingroup$ Many thanks for this. I have been working on the problem looking at R's non-linear solutions. The unitroot I came across and what you have here looks a good solution. I will try this for the three +/- ranges and see if the sigmas do in fact differ. $\endgroup$ Feb 24, 2017 at 21:12