For today you should have:
I recently ran the James Joyce Ramble 10K in Dedham MA. The results are available
here. Go to that page and find my results.
What is my percentile rank in the field (all runners)?
What is my percentile rank in my division (M4049 means ``male between 40 and 49 years of age'')?
What division are you in?
How fast do you have to run a 10K to ``beat'' me in terms of percentile ranks?
Can you do it?
My solution to Exercise 2.8 is in http://thinkstats.com/risk.py. Output:
ProbEarly live births 0.175120244862
ProbEarly first babies 0.182415590301
ProbEarly others 0.168321013728
ProbOnTime live births 0.701355487538
ProbOnTime first babies 0.662134602311
ProbOnTime others 0.737909186906
ProbLate live births 0.123524267599
ProbLate first babies 0.155449807387
ProbLate others 0.0937697993664
Risk ratios (first babies / others):
What is the relative risk of being born early for first babies, relative to others?
When is relative risk a good choice of summary statistic? What are some alternatives?
Read Exercise 2.9.
Sketch Python code for the algorithm in Section 2.9.
Practice Quiz question:
Strictly speaking, when you compute a cumulative PMF, the result is a CMF, but no one calls it that.
1) Map from values to percentile ranks (or probabilities).
2) Reverse map from percentile ranks to values.
3) My implementation is a sorted list of values and a sorted list of probabilities.
Both use bisect, so they take log n time.
Tricky to get the corner cases right.
3) To iterate through the items in a CDF use GetItems().
4) For plotting, especially small n, it is important to draw a step function. That's what Render() is for.