๐ Phase 2: Mathematics & Statistics for Data Science
๐ Topic 11: Confidence Intervals
In Data Science, we usually work with a sample, but our goal is often to understand the larger population.
For example:
You survey 1,000 customers and find that 72% are satisfied.
But the real question is:
"What is the likely satisfaction rate among all customers?"
A confidence interval helps us answer this by providing a range of plausible values instead of relying on a single estimate.
๐น 1. What Is a Confidence Interval?
A confidence interval (CI) is a range of values used to estimate an unknown population parameter.
Instead of saying:
"The average customer satisfaction score is 7.4."
we could say:
"The estimated average is 7.4, with a 95% confidence interval from 7.1 to 7.7."
So:
Confidence Interval = Point Estimate ยฑ Margin of Error
๐น 2. What Is a Point Estimate?
A point estimate is a single value calculated from sample data to estimate a population parameter.
For example, suppose we randomly select 500 employees and calculate their average salary:
Sample Mean = โน60,000
We can use โน60,000 as an estimate of the average salary of the entire employee population.
Here:
Population mean โ Unknown
Sample mean โ โน60,000
โน60,000 โ Point estimate
Common examples:
โข Population mean โ Sample mean
โข Population proportion โ Sample proportion
โข Population variance โ Sample variance
๐น 3. Why Isn't a Point Estimate Enough?
Suppose you calculate the average income from a sample:
Average = โน60,000
If you take another random sample, you might get:
Average = โน61,200
Another sample might give:
Average = โน59,300
Why does this happen?
Because of sampling variability.
Different samples can produce different results.
Therefore, saying:
"The population average is exactly โน60,000"
would give us more certainty than the data actually supports.
Instead, we can provide a range:
"The population average is likely to be somewhere within this range."
That range is the confidence interval.
๐น 4. Margin of Error
The margin of error tells us how far the confidence interval extends from the point estimate.
Suppose:
Point Estimate = 70
Margin of Error = 3
Then:
Confidence Interval = 70 ยฑ 3
Therefore:
Lower Limit = 67
Upper Limit = 73
So the confidence interval is:[67,73]
๐น 5. General Confidence Interval Formula
A simple representation is:
Confidence Interval = Estimate ยฑ Critical Value ร Standard Error
Where:
โข Estimate โ Point estimate
โข Critical Value โ Depends on the confidence level and statistical distribution
โข Standard Error โ Measures uncertainty in the estimate
For example:
Estimate = 50
Margin of Error = 2
Therefore:
Confidence Interval = 50 ยฑ 2
So: CI =[48, 52]
๐น 6. Common Confidence Levels
Some commonly used confidence levels are:
โข 90% โ 1.645
โข 95% โ 1.96
โข 99% โ 2.576
The 95% confidence level is especially common in statistics and Data Science.
๐น 7. What Does a 95% Confidence Interval Mean?
This is one of the most important concepts for interviews.
Suppose we calculate:
95% CI =[48,52]
A common incorrect interpretation is:
"There is a 95% probability that the true population mean is between 48 and 52."