RM - Unit 103 - Confidence intervals
Book: Analysing Data Using Linear Models
Chapter 2.9, 2.10
Chapter 2.9: Constructing confidence intervals
The 95% confidence interval is the most widely used, but other intervals are also seen. For instance, the
99% confidence interval and the 90% confidence interval. A 99% confidence interval is wider than a 95%
confidence interval, which in turn is wider than a 90% confidence interval. The width of the confidence
interval also depends on the sample size.
As we discussed for the 95% interval above, we looked at the t-distribution of
3 degrees of freedom because we had a sample size of 4 elephants. Suppose we
have a sample size of 200, then we would have to look at a t-distribution of 200−1
= 199 degrees of freedom. Table 2.2 shows information about a couple of t-
distributions with different degrees of freedom. In the first column, cumulative
probabilities are given, and the next column gives the respective quantiles. For
instance, the column ’norm’ shows that a cumulative proportion of 0.025 is
associated with a quantile of -1.96 for the standard normal distribution. This means
that for the normal distribution, 2.5% of the observations are smaller than -1.96. In
the same column we see that the quantile 1.96 is associated with a cumulative
probability of 0.975. This means that 97.5% of the observations in a normal
distribution are smaller than 1.96. This implies that 100% - 97.5% = 2.5% of the
observations are larger than 1.96. Thus, if 2.5% of the observations are larger than
1.96 and 2.5% of the observations are smaller than -1.96, then 5% of the
observations are outside the interval (-1.96, 1.96), and 95% are inside this interval.
With a 90% confidence interval, 10% lies outside the interval. We can divide that equally
to 5% on the low side and 5% on the high side. We therefore have to look at cumulative probabilities 0.05
and 0.95 in Table 2.2. The corresponding quantiles for the normal distribution are -1.64 and 1.64, so we
can say that for the normal distribution, 90% of the values lie in the interval (-1.64, 1.64). For a t-
distribution with 9 degrees of freedom, we see that the corresponding values are -1.83 and 1.83. Thus we
conclude that with a t-distribution with 9 degrees of freedom, 90% of the observed values lie in the
interval (-1.83, 1.83).
Constructing confidence intervals -
1. Compute the sample mean ¯y.
2. Estimate the population variance s 2 = Σi(yi−y¯) n−1 .
3. Estimate the standard error ˆσy¯ = q s 2 n .
4. Compute degrees of freedom as n − 1.
5. Look up t 1−x 2 . Take the t-distribution with the right number of degrees of
freedom and look for the critical t-value for the confidence interval: if x is the
confidence level you want, then look for quantile 1−x 2 . Then take its absolute
value. That’s your t 1−x 2 .
6. Compute margin of error (MoE) as MoE = t 1−x 2 × σˆy¯.
7. Subtract and sum the sample mean with the margin of error: (¯y−MoE, y¯+ MoE).
Book: Analysing Data Using Linear Models
Chapter 2.9, 2.10
Chapter 2.9: Constructing confidence intervals
The 95% confidence interval is the most widely used, but other intervals are also seen. For instance, the
99% confidence interval and the 90% confidence interval. A 99% confidence interval is wider than a 95%
confidence interval, which in turn is wider than a 90% confidence interval. The width of the confidence
interval also depends on the sample size.
As we discussed for the 95% interval above, we looked at the t-distribution of
3 degrees of freedom because we had a sample size of 4 elephants. Suppose we
have a sample size of 200, then we would have to look at a t-distribution of 200−1
= 199 degrees of freedom. Table 2.2 shows information about a couple of t-
distributions with different degrees of freedom. In the first column, cumulative
probabilities are given, and the next column gives the respective quantiles. For
instance, the column ’norm’ shows that a cumulative proportion of 0.025 is
associated with a quantile of -1.96 for the standard normal distribution. This means
that for the normal distribution, 2.5% of the observations are smaller than -1.96. In
the same column we see that the quantile 1.96 is associated with a cumulative
probability of 0.975. This means that 97.5% of the observations in a normal
distribution are smaller than 1.96. This implies that 100% - 97.5% = 2.5% of the
observations are larger than 1.96. Thus, if 2.5% of the observations are larger than
1.96 and 2.5% of the observations are smaller than -1.96, then 5% of the
observations are outside the interval (-1.96, 1.96), and 95% are inside this interval.
With a 90% confidence interval, 10% lies outside the interval. We can divide that equally
to 5% on the low side and 5% on the high side. We therefore have to look at cumulative probabilities 0.05
and 0.95 in Table 2.2. The corresponding quantiles for the normal distribution are -1.64 and 1.64, so we
can say that for the normal distribution, 90% of the values lie in the interval (-1.64, 1.64). For a t-
distribution with 9 degrees of freedom, we see that the corresponding values are -1.83 and 1.83. Thus we
conclude that with a t-distribution with 9 degrees of freedom, 90% of the observed values lie in the
interval (-1.83, 1.83).
Constructing confidence intervals -
1. Compute the sample mean ¯y.
2. Estimate the population variance s 2 = Σi(yi−y¯) n−1 .
3. Estimate the standard error ˆσy¯ = q s 2 n .
4. Compute degrees of freedom as n − 1.
5. Look up t 1−x 2 . Take the t-distribution with the right number of degrees of
freedom and look for the critical t-value for the confidence interval: if x is the
confidence level you want, then look for quantile 1−x 2 . Then take its absolute
value. That’s your t 1−x 2 .
6. Compute margin of error (MoE) as MoE = t 1−x 2 × σˆy¯.
7. Subtract and sum the sample mean with the margin of error: (¯y−MoE, y¯+ MoE).