Confidence Intervals for Population Mean and Variance of Normal Data
Normal Data. Suppose you have vector x
with $n=25$ observations, sampled using R, from $\mathsf{Norm}(\mu = 100, \sigma=25)$ and seek 95% confidence intervals for $\mu$ and $\sigma^2.$
set.seed(104)
x = round(rnorm(25, 100, 25), 2)
summary(x); var(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
58.94 86.98 96.02 99.94 115.69 136.20
[1] 416.2467 # sample variance
95% CI for Population Mean. The t.test
procedure in R provides the computation of a 95% CI ${91.52, 108.36}$ for $\mu:$
t.test(x)$conf.int
[1] 91.51802 108.36118
attr(,"conf.level")
[1] 0.95
Here the CI does cover $\mu = 100,$ as should
be the case, over the long run, for 95% of datasets of size 25 sampled from
$\mathsf{Norm}(\mu = 100, \sigma=25).$
The formula is $\bar X \pm t^*2S/\sqrt{n},$ where
$t^*$ cuts probability 0.25 from the upper tail of Student's t distribution with $n-1$ degrees of freedom.
This formula is explained in most elementary statistics
texts. You can find values of $t^*$ in printed tables of Student's t distribution.
(5% CI for Population Variance and SD. To get a 95% CI for $\sigma^2$ one uses the relationship
$(n-1)S^2/\sigma^2 \sim \mathsf{Chisq}(n-1)$ to find
$l$ and $U$ such that
$$0.95 = P\left(L \le \frac{(n-1)S^2}{\sigma^2} \le U\right) = P\left(\frac{(n-1)S^2}{U} \sigma^2 \le \frac{(n-1)S^2}{U}\right),$$
where $L$ and $U,$ respectively,cut probability 0.025 from the lower
and upper tails of (the asymmetrical) distribution $\mathsf{Chisq}(n-1).$ [You can find values of $
L$ and $U$ in printed tables of the chi-squared distribution. Their values from R are $L = 12.40$ and $U = 39.36.]$
qchisq(c(.025,.975), 24)
[1] 12.40115 39.36408
For the data in x
we have the 95% CI $(253,8,805,6).$
24*var(x)/qchisq(c(.975,.025), 24)
[1] 253.7827 805.5640
A 95% CI $(15.93, 28,38)$ for $\sigma$ is found by taking square roots of endpoints. So this is one of the 95% of cases in which the CI includes $\sigma=25.$
sqrt(24*var(x)/qchisq(c(.975,.025), 24))
[1] 15.93056 28.38246
Notice that neither the CI for $\sigma^2$ nor the CI for $\sigma$ is of the form
$$\text{Point Estimate} \pm \text{Margin of Error}.$$ That is, the point estimate is typically not at the center of the CI.