Statistical inference: confidence interval

00Comment iconComment iconComment iconComment icon

Explore the concept of confidence intervals in statistical inference, its importance in data analysis, and how it helps estimate the accuracy of measurements in research and scientific studies.

Writer image

Translated byEditorial

Writer image

Revised byEditorial

Edit Article

What is statistical inference

The word inference, in this context, means conclusive. For statistical inference, we want to draw conclusions about our dataset from models.

Statistical inference makes propositions about a universe, using data drawn from a sample. Given a hypothesis about a universe from which we want to draw inferences, statistical inference consists of (first) selecting a statistical model of the process that generates the data and (second) deducing the propositions from the model.

One of the most important tools in statistical inference is the confidence interval (CI), which provides a range of values that likely contains the true population parameter, such as the mean or proportion. The confidence interval not only estimates the parameter but also expresses the uncertainty associated with that estimate.

In this lesson, we will explore the concept of confidence interval, how it is constructed and interpreted, as well as its applications in various areas.

When to use a Confidence Interval

Confidence intervals are used to indicate the reliability of an estimate. For example, a CI can be used to describe how reliable the results of a survey are. All estimates being equal, a survey that results in a small CI is more reliable than one that results in a larger CI.

We can interpret the confidence interval as an interval that contains the "plausible" values that the population mean may take. Thus, the width of the interval is associated with the uncertainty we have regarding the parameter.

Let's understand this interval with an example: what is the average of rolling a 6-sided die? The average is 3.5; in other words, the population has a mean of 3.5. Now, imagine that by rolling a die 5 times, we collect the following data:

\[ 1,6,3,2,1 \]

The sample mean is 2.6!!

Now we roll 5 dice again:

\[ 5,3,6,3,1 \]

This time the sample mean is 3.83!!

Simulations with the sample mean

What if we start saving this mean result? Let's do some simulations:

Simulations for a sample of size 5

For 10 groups of 5 dice rolls (sample size 5)

Image content of the Website

For 30 groups of 5 dice rolls (sample size 5)

Image content of the Website

For 70 groups of 5 dice rolls (sample size 5)

Image content of the Website

For 200 groups of 5 dice rolls (sample size 5)

Image content of the Website

For 2000 groups of 5 dice rolls (sample size 5)

Image content of the Website

After a certain amount, it is possible to see a normal curve occurring. But it took a while for the normal curve to appear, so let's make a change: what if we use a sample of size 200? That is, let's look at the mean after rolling 200 dice; the mean is expected to be around 3.5, as it is in the population! Let's go to the simulations:

Simulations for a sample of size 200

For 10 groups of 200 dice rolls (sample size 5)

Image content of the Website

For 70 groups of 200 dice rolls (sample size 5)

Image content of the Website

For 200 groups of 200 dice rolls (sample size 5)

Image content of the Website

For 2000 groups of 200 dice rolls (sample size 5)

Image content of the Website

Again the graph is similar to a normal distribution!

Conclusions about the simulations

Two points can be observed:

The graph is similar to a normal distribution. In this case, we will use the central limit theorem again: In repeated experiments, the mean of a sample will tend toward a normal distribution.

The width of the first is different from the width of the second. When dealing with samples, the larger your sample, the smaller the standard deviation of the sample mean.

Sample mean

Thus, we say that the sample mean is normally distributed. The variance of the sample mean is the population variance divided by the sample size:

\[ \text{Var}(\bar{X}) = \frac{\sigma^2}{n} \]

It depends on the sample mean and the sample standard deviation divided by the square root of the sample size.

\[ \bar{X} \sim N\left(\mu, \frac{\sigma^2}{n}\right) \]

Significance in the confidence interval of the sample mean

The size of the interval is defined by the normal distribution of the sample mean and the chosen confidence level. For example, it is common to use 95% confidence for these calculations; this means that 95% of the time, the population mean will be in this interval. Confidence is inversely proportional to significance; significance is linked to the error of the test. In this case, a confidence level of 95% means a significance level of 5%.

In this case, this confidence is called alpha, and we look for an interval in which the population mean will encompass the given confidence:

Image content of the Website

Thus, given the confidence level you would like to have: 90%, 95%, 98%, 99%, etc... you will look for the points that make it possible to have an interval with that confidence. In two-tailed intervals, an interval that extends both to the right and to the left, we look for the points that leave half of the error probability to the left and half to the right.

Therefore, we have the lower limit (a):

\[ a = \bar{X} - z *\frac{\sigma}{\sqrt{n}} \]

And the upper limit (b):

\[ b = \bar{X} + z *\frac{\sigma}{\sqrt{n}} \]

With these two points, we can build an interval that represents where the population mean is likely to be.

Real example

An opinion poll interviewed 2,500 people regarding whether they will vote or not vote for candidate A. On average, 20% of the respondents will vote for candidate A, and we know that the population standard deviation is 40%, since the sample deviation is 40% and we have a very large sample (more than 2,000 people). A consulting company wants to build a confidence interval for the population mean; in other words, to be able, from this sample, to define how many people will vote for candidate A in the total population. To do this, it defined that there will be 5% significance or 95% confidence in its interval.

A two-tailed 95% confidence interval indicates that there will be 2.5% error on the right and on the left. Knowing that the mean of a sample behaves like a normal distribution, the Z that establishes the 2.5% error on the left is -1.96 and the Z that establishes the 2.5% error on the right is 1.96. In summary:

\[ −1.96<\text{our interval in the standard normal}<1.96 \]

In this case it is in the standard normal. We must therefore transform it to the normal distribution of the question, which has a mean of 20%.

\[ P(X<2.5\%)=20\%−1.96∗\frac{40\%}{√2500}=18.43\% \]

\[ P(X>97.5\%)=20\%+1.96∗\frac{40\%}{√2500}=21.56\% \]

What would happen if we used the same parameters from the previous exercise, but 40% of the respondents will vote for candidate A with a population standard deviation of 24%?

\[ P(X<2.5\%)=40\%−1.96∗\frac{24\%}{√2500}=39.05\% \]

\[ P(X>97.5\%)=40\%+1.96∗\frac{24\%}{√2500}=40.94\% \]

What would happen if we used the same parameters from the previous exercise, but with a significance level of 2%?

A significance level of 2% means that we will ignore the lower 1% of means or the upper 1% of means:

\[ P(X<1\%)=40\%−2.33∗\frac{24\%}{√2500}=38.88\% \]

\[ P(X>99\%)=40\%+2.33∗\frac{24\%}{√2500}=41.11\% \]

Exercises

1) If a random sample n=25 has a sample mean of 51.3 and a population standard deviation of σ=2, construct the 95% confidence interval for the population mean µ.

2) It is known that the life in hours of a 75W light bulb is approximately normally distributed with a standard deviation of σ=25. A random sample of 20 bulbs has an average life of 1,014 hours. Construct a 95% confidence interval for the mean life.

3) What should the sample size be so that the 99.5% confidence interval for the population mean has a half-width no greater than 1.5? It is known that the population variance is 23.

4) What should be the size of a sample whose standard deviation is 10 so that the difference between the sample mean and the population mean, in absolute value, is less than 1, with a confidence coefficient equal to:

a) 95%

b) 99%

5) A random variable X has a normal distribution, with sample mean 100 and population standard deviation 10. If the sample size is 16 elements, calculate P(90 < population mean < 110).

6) What size should a sample with sample mean 100 and population standard deviation 10 have so that P(90 < population mean < 110) = 95%?

7) A random sample of 625 housewives reveals that 70% of the sample prefer brand A detergent with a population standard deviation of 45%. Construct a confidence interval for p = proportion of housewives who prefer A with confidence coefficient γ = 90%.

8) Suppose we are interested in estimating the percentage of consumers of a certain product. If the sample of size 300 provided 100 individuals who consume the given product, determine the confidence interval of the population mean, with c.c. of 95%; interpret the result. (Proportion standard deviation can be calculated by the formula: p x ( 1 − p ))

Answer Key

1) C.I. = 51.3 ± 0.78;

2) C.I. = 1014 ± 11;

3) 81;

4) a) 385; b) 665;

5) Almost 100%;

6) Approximately 4.

7) (0.6692 ; 0.7308).

8) (0.280; 0.387).