# Confidence Intervals

March 29, 2018

Back to: Random Testing

When calculating the *point estimate* of a random variable (such as the mean value) it is possible to determine the probable error in the estimate. This can be done by evaluating a *confidence interval*, associated with a *confidence level*, for the estimate. It is important to understand that both the confidence *interval* and the confidence *level* go together. A higher confidence *level* requires a wider confidence *interval*. A lower confidence *level* allows a narrower confidence *interval*.

When summing independent random variables, the* mean values *and* variances* add. For example, when summing independent random variables A and B:

The result in Eq. 13 can be used to determine the standard deviation of the mean value, x , computed from *N* random variables, *x*, with a known standard deviation *s** _{x}*. The sum of the

*x*‘s will have a variance of

*N*

*s*

_{x}^{2}and, therefore, a standard deviation of

*s*

*. Dividing by*

_{x}*N*to compute the standard deviation of the mean value, x, gives

This result is used to determine the *confidence interval* of an estimated mean value, assuming x is Normally distributed. It is important to realize that the confidence interval depends on the probability or *confidence level* of that interval. This is determined by the probability of the value being within a certain number of standard deviations σ _{x} from the true mean *μ*, as shown by the area P in this picture:

The confidence level, P is plotted in Fig. 12 as a function of z, the number of standard deviations σ _{x} from the true mean *μ*. Therefore, a confidence interval of ±1 σ _{x} has a confidence level of 68%. (The 95% confidence interval is ±2 σ _{x} , the 99.7% confidence interval is ±3 σ _{x} , etc.)

[Note from Eq. 14 that →σ _{x} as *N*→∞.]

Because of the Central Limit Theorem, the Normal distribution is almost always assumed for the estimation of the mean value. Using the example in the previous section of the mean value obtained from an average of four values, the standard deviation of the uniform distribution (-0.5, 0.5) is 0.144. Assuming a Normal distribution, the 95% confidence interval would be ±0.288. In reality the 95% confidence interval is 0.24.

When the values of the mean and standard deviation are obtained from a small data sample, the determination of the confidence interval is more complicated. In this case it is common to use the ** t-distribution** which gives larger confidence intervals for the same confidence level due to the increased uncertainty in the sample distribution. For

*N*> 3 samples, the variance of the sample mean is increased by a ratio of (

*N*– 1) / (

*N*– 3) compared to using Eq. 13. Fig. 13 shows the modified number (

*t*

_{value}) of standard deviations σ

_{x}used for the confidence interval for different confidence levels as a function of the number of samples used. Then the estimate for the true mean is

For *N* > 50, the t-distribution converges to the Normal distribution and Fig. 13 can be used.

It should be noted that the confidence level is often omitted in the statement of the confidence interval. In many cases a confidence level of 95% is assumed and a confidence interval of approximately ± 2σ is used. This is true in many opinion polls when a ± % *margin of error* is appended to the percentage results given. In surveys with *N* respondents the standard deviation is assumed to be σ = 0.5/*N*^{1/2}, so a margin of error of ± 4% (with a confidence level of 95%) simply means that approximately *N* = 1/(0.04)^{2} = 625 people were surveyed. (4% = 0.04 = 2σ = 1/* N*^{1/2})