Lecture 23
Confidence Intervals
DATA 8
Spring 2022
Announcements
Percentiles
Computing Percentiles
The pth percentile is first value on the sorted list that is at least as large as p% of the elements.
Example: s = [1, 7, 3, 9, 5]
s_sorted = [1, 3, 5, 7, 9]
If p% does not exactly correspond to an element (e.g. 85th percentile), take the next greater element (9).
The 80th percentile is ordered element 4: (80/100) * 5
percentile(80, s) is 7
Percentile
Data array
The percentile Function
percentile(p, values_array)
(Demo)
Discussion Question
Which are True, when s = [1, 5, 7, 3, 9]?
percentile(10, s) == 0
percentile(39, s) == percentile(40, s)
percentile(40, s) == percentile(41, s)
percentile(50, s) == 5
(Demo)
Estimation
Inference: Estimation
(Demo)
Variability of the Estimate
(Demo)
Quantifying Uncertainty
(Demo)
Where to Get Another Sample?
The Bootstrap
The Bootstrap
The Problem
population
sample
What we wish we could see
What we get to see
Why the Bootstrap Works
population
sample
resamples
All of these look pretty similar, most likely.
Why We Need the Bootstrap
population
sample
resamples
We can’t see the parameter
But we can see the sample ...
and generate lots of resamples
The Bootstrap Principle
≈ Sampling from the population
Key to Resampling
The Bootstrap Process
One Random Sample
(population)
(the original sample)
Bootstrap:
(Demo)
Confidence Intervals
95% Confidence Interval
(Demo)