Normal distribution - calculating variance given mean and confidence interval

361 Views Asked by At

Consider a normally distributed random variable $X$, of which we know the mean $\mu$ but not the variance $\sigma^2$. If we know the $(1-\alpha)$ confidence interval of $X$. That is, we know the interval $X_\alpha =[x_{l,\alpha}, x_{u,\alpha}]$ such that $P(X \in X_\alpha) = 1-\alpha$. Note that the value of $\alpha$ is also known. How can we find the variance of $X$?

I know that I can write:

\begin{equation} P(X \leq x_{u,\alpha}) = 1 - \frac{\alpha}{2} = \Phi \left( \frac{x_{u,\alpha} - \mu}{\sigma}\right) = \frac{1}{2}\left[1+erf\left( \frac{x_{u,\alpha} - \mu}{\sigma \sqrt{2}}\right) \right] \end{equation}

But is there an efficient way to solve this for $\sigma$? Preferably using statistical packages in Python (e.g. scipy or numpy). Or perhaps a different approach? Thanks!

1

There are 1 best solutions below

0
On

Assume your confidence interval is $(x_{l,\alpha},x_{u,\alpha})$. We know the equation for a confidence interval is $$\bar{X} - Z_{\alpha/2} \frac{\sigma}{\sqrt{n}} \leq X \leq \bar{X} + Z_{\alpha/2} \frac{\sigma}{\sqrt{n}}.$$ Just solving for both sides of the equation: $$ \bar{X} - Z_{\alpha/2} \frac{\sigma}{\sqrt{n}} = x_{l,\alpha} \\ \bar{X} + Z_{\alpha/2} \frac{\sigma}{\sqrt{n}} = x_{u,\alpha}, $$ you can find an equation for your variance.