Statistical inference: confidence interval

, محدث •0•0Comment iconComment iconComment iconComment icon

Understand the confidence interval: sampling distribution of the mean, standard error, confidence level, how to calculate and interpret it, with exercises.

Writer image

تمت الترجمة بواسطةEditorial

Writer image

تمت المراجعة بواسطةEditorial

تحرير المادة

What is statistical inference

To infer is to draw a conclusion from evidence. In statistical inference, we draw conclusions about an entire population from the data of a sample, with the help of probability models.

Statistical inference makes statements about a population using data drawn from a sample. Given a question about that population, inference consists of first choosing a statistical model of the process that generates the data and then deriving the statements from that model, always accompanied by a measure of uncertainty.

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

In this lesson, we will look at the concept of the confidence interval, how it is built and interpreted, and its applications.

When to use a confidence interval

Confidence intervals are used to indicate the precision of an estimate. For example, a CI can be used to describe how precise the results of a survey are. At the same confidence level, a survey that yields a narrow CI is more precise than one that yields a wide CI.

We can interpret the confidence interval as an interval containing the "plausible" values for the population mean. Thus, the width of the interval is associated with the uncertainty we have about the parameter.

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

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

The sample mean is 13/5 = 2.6!

Now we roll 5 dice again:

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

This time, the sample mean is 18/5 = 3.6!

Each sample gives a different mean, and none of them is exactly 3.5. The question is: how do these sample means behave?

Simulations with the sample mean

What if we start recording the result of each mean? Let's run some simulations:

Simulations for a sample of size 5

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

Image content of the Website

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

Image content of the Website

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

Image content of the Website

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

Image content of the Website

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

Image content of the Website

After a certain number of groups, we can see a normal curve emerging, with the means spread between 1 and 6. What if we use a sample of size 200? That is, we will calculate the mean after rolling 200 dice; we expect it to stay around 3.5, like the population mean. On to the simulations:

Simulations for a sample of size 200

For 10 groups of 200 die rolls (sample of size 200)

Image content of the Website

For 70 groups of 200 die rolls (sample of size 200)

Image content of the Website

For 200 groups of 200 die rolls (sample of size 200)

Image content of the Website

For 2000 groups of 200 die rolls (sample of size 200)

Image content of the Website

Once again the graph looks like a normal, but now all the means fall between 3.1 and 4.0!

Conclusions from the simulations

Two points stand out:

The graph looks like a normal. This is the central limit theorem again: in repeated experiments, the mean of a sample tends to follow a normal distribution.

The width of the first is different from the width of the second. The larger the sample, the smaller the standard deviation of the sample mean.

Sample mean

So we say that the sample mean has an approximately normal distribution (exactly normal if the population is normal). Its mean is the population mean, μ, and its variance is the population variance divided by the sample size:

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

That is, the standard deviation of the sample mean, called the standard error, is the population standard deviation divided by the square root of the sample size, σ/√n. In short:

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

For the die, the population standard deviation is about 1.71. With samples of 5 rolls, the standard error is 1.71/√5 ≈ 0.76; with 200 rolls, it drops to 1.71/√200 ≈ 0.12, which explains why the second set of histograms is so much narrower.

A population has a standard deviation of 12. What is the standard deviation of the mean of samples of size 36?

Loading icon

Answer: 2 — the standard error is σ/√n = 12/√36 = 12/6 = 2. The 0.33 comes from dividing by n instead of √n, and 12 is the standard deviation of a single observation, not of the mean.

The confidence level of the interval for the mean

The size of the interval is determined by the distribution of the sample mean and by the chosen confidence level. It is common to use 95% confidence. This means that if we repeated the sampling many times and built an interval each time, about 95% of these intervals would contain the true population mean. The population mean is a fixed value; what varies from sample to sample is the interval.

Confidence and significance are complementary: the significance level, written α (alpha), is the probability of error, that is, of the interval not containing the parameter. A confidence of 95% corresponds to a significance of 5% (α = 0.05), and in general confidence = 1 − α.

So we look for an interval that has probability 1 − α of covering the population mean:

Image content of the Website

Thus, given the desired confidence level (90%, 95%, 98%, 99%, etc.), we look for the points that bound an interval with that confidence. In a two-sided (two-tailed) interval, which extends to both sides of the mean, we leave half of the error probability, α/2, in each tail, as in the figure.

So the lower limit (a) is:

\[ a = \bar{X} - z_{\alpha/2} \cdot \frac{\sigma}{\sqrt{n}} \]

And the upper limit (b) is:

\[ b = \bar{X} + z_{\alpha/2} \cdot \frac{\sigma}{\sqrt{n}} \]

With these two points, we build an interval that indicates where the population mean is probably located. The most commonly used z values are 1.645 (90%), 1.96 (95%), 2.33 (98%) and 2.576 (99%).

A 95% confidence interval for the mean was calculated as 48 to 52. What is the correct interpretation?

Loading icon

Answer: The method used produces intervals that contain the population mean in 95% of samples — confidence refers to the procedure: the population mean is fixed and each sample produces a different interval. The CI does not describe where 95% of the data lie either, and the sample mean is always at the center of the interval.

Real example

An opinion poll interviewed 2,500 people about whether or not they will vote for candidate A. In the sample, 20% of respondents said they will vote for candidate A. Since each answer is a Bernoulli variable, the standard deviation is √(0.2 × 0.8) = 0.4, or 40%; with such a large sample, we can use this value as the population standard deviation. A consulting firm wants to build a confidence interval for the proportion of candidate A's voters in the whole population, with 5% significance, or 95% confidence.

A two-tailed 95% confidence interval leaves 2.5% of error on the left and 2.5% on the right. Since the mean of a sample behaves like a normal, the z that leaves 2.5% on the left is −1.96 and the z that leaves 2.5% on the right is 1.96. In short:

\[ -1.96 < Z < 1.96 \]

This interval is on the standard normal. We need to transform it to the scale of the problem, whose mean is 20%:

\[ \text{lower limit} = 20\% - 1.96 \cdot \frac{40\%}{\sqrt{2500}} = 20\% - 1.57\% = 18.43\% \]

\[ \text{upper limit} = 20\% + 1.96 \cdot \frac{40\%}{\sqrt{2500}} = 20\% + 1.57\% = 21.57\% \]

With 95% confidence, the proportion of candidate A's voters in the population is between 18.43% and 21.57%.

What would happen if we used the same parameters, but with 40% of respondents saying they will vote for candidate A?

The standard deviation also changes, because it depends on the proportion: √(0.4 × 0.6) ≈ 0.49, or 49%.

\[ \text{lower limit} = 40\% - 1.96 \cdot \frac{49\%}{\sqrt{2500}} = 40\% - 1.92\% = 38.08\% \]

\[ \text{upper limit} = 40\% + 1.96 \cdot \frac{49\%}{\sqrt{2500}} = 40\% + 1.92\% = 41.92\% \]

What would happen if we used the same parameters as the previous example, but with 2% significance?

A significance of 2% means leaving 1% of error in each tail, which corresponds to z = 2.33:

\[ \text{lower limit} = 40\% - 2.33 \cdot \frac{49\%}{\sqrt{2500}} = 40\% - 2.28\% = 37.72\% \]

\[ \text{upper limit} = 40\% + 2.33 \cdot \frac{49\%}{\sqrt{2500}} = 40\% + 2.28\% = 42.28\% \]

Notice that with more confidence the interval gets wider: to be more certain of capturing the parameter, we give up precision.

A poll of 400 people found 50% approval, with a standard deviation of 50%. What is the margin of error of the 95% confidence interval?

Loading icon

Answer: 4.9 percentage points — the standard error is 50%/√400 = 50%/20 = 2.5%, and the margin is 1.96 × 2.5% = 4.9%. The 2.5 is just the standard error, without multiplying by z, and the 9.8 is the total width of the interval, not the margin.

Exercises

1) A random sample of size n = 25 has a sample mean of 51.3, and the population standard deviation is σ = 2. Build the 95% confidence interval for the population mean μ.

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

3) What sample size is needed for the 99.5% confidence interval for the population mean to have a half-width no greater than 1.5? The population variance is known to be 23.

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

a) 95%

b) 99%

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

6) What sample size would the previous exercise need (population mean 100 and population standard deviation 10) for P(90 < X̄ < 110) = 95%?

7) A random sample of 625 homemakers shows that 70% of them prefer brand A detergent; the standard deviation is √(0.7 × 0.3) ≈ 45.8%. Build a confidence interval for p = the proportion of homemakers who prefer A, with confidence coefficient γ = 90%.

8) Suppose we want to estimate the percentage of consumers of a certain product. If a sample of size 300 yielded 100 individuals who consume the product, find the confidence interval for the population proportion, with a 95% confidence coefficient, and interpret the result. (The standard deviation of a proportion is given by √(p(1 − p)).)

Answer key

1) C.I. = 51.3 ± 0.78;

2) C.I. = 1014 ± 11;

3) 81;

4) a) 385; b) 664;

5) Almost 100% (99.994%);

6) Approximately 4.

7) (0.670 ; 0.730).

8) (0.280 ; 0.387). With 95% confidence, between 28.0% and 38.7% of the population consume the product.

ما رأيك في هذا المقال؟

0%
تقييم المستخدمين (0)

شارك هذا المقال!