In classical frequentist statistics, this is not technically correct.
A better interpretation is:
If we repeatedly took random samples and constructed confidence intervals using the same method, approximately 95% of those intervals would contain the true population parameter.
In everyday communication, we often say:
"We are 95% confident that the true population parameter lies within this interval."
๐น
8. Confidence Level and Interval WidthA higher confidence level generally produces a wider confidence interval.
For example:
โข 90% CI โ [48.5, 51.5]
โข 95% CI โ[48,52]
โข 99% CI โ[47,53]
The exact values depend on the data, but the general relationship is:
Higher confidence โ Wider interval
Lower confidence โ Narrower interval
Why? Because if we want greater confidence that our interval captures the true population parameter, we need to consider a wider range of possible values.
๐น
9. Sample Size and Confidence IntervalSample size has a major impact on confidence intervals.
For a sample mean:
Standard Error = Standard Deviation / โSample Size
As sample size increases:
Sample Size โ โ Standard Error โ
Therefore: Larger Sample โ Smaller Uncertainty โ Narrower Confidence Interval
For example:
Suppose Standard Deviation = 20
With n = 100 โ SE = 20 / โ100 = 20 / 10 = 2
If we increase the sample size to n = 400 โ SE = 20 / โ400 = 20 / 20 = 1
The standard error has decreased. This means the estimate becomes more precise.
๐น
10. Standard Deviation vs Standard ErrorThese concepts are often confused.
Standard DeviationStandard deviation measures how spread out individual observations are.
Example:
How different are individual employee salaries from the average salary?
Standard ErrorStandard error measures how much a sample statistic, such as the sample mean, is expected to vary from sample to sample.
For the sample mean: SE = SD / โn
So: SD = 20, n = 100, Then SE = 20 / 10 = 2
Therefore: Standard Deviation = 20, Standard Error = 2
They measure different things.
๐น
11. Example of a Confidence IntervalSuppose we have:
Sample mean = 50
Sample standard deviation = 10
Sample size = 100
Confidence level = 95%
For illustration, let's use a critical value of approximately 1.96.
First calculate the standard error:
SE = 10 / โ100 = 10 / 10 = 1
Now calculate the margin of error:
Margin of Error = 1.96 ร 1 = 1.96
Therefore: CI = 50 ยฑ 1.96
So: Lower Limit = 48.04, Upper Limit = 51.96
Therefore: 95% CI = [48.04, 51.96]
๐น
12. Confidence Interval Using PythonPython's scipy library can be used to calculate confidence intervals.
import numpy as np
from scipy import stats
data = np.array([48, 51, 49, 52, 50, 47, 53, 51, 49, 50])
mean = np.mean(data)
confidence_level = 0.95
confidence_interval = stats.t.interval(
confidence_level,
df=len(data) - 1,
loc=mean,
scale=stats.sem(data)
)
print("Mean:", mean)
print("95% Confidence Interval:", confidence_interval)