For today you should have: - Done Homework 3.
Today: - Practice quiz.
- Are you popular?
- Distribution of percentiles.
- Python style.
- myplot.py
For next time: - Read Chapter 4.
- Prepare for a quiz on Chapters 1-3. Note: you will be allowed to use anything in the Pmf and Cdf APIs.
## Practice quiz
1) Exercise 3-1. 2) When statisticians talk about income and wealth, they almost always use medians and other percentiles rather than means. Why? For this and other short-answer questions, you should write 1-2 complete sentences that would be understood by an intelligent adult with only casual knowledge of statistics. 3) For the set of values {1, 2, 2, 3, 3, 3, 4, 4, 4, 4}, what is CDF(3)? What is the 30th percentile? What is the 40th percentile? ## Are you popular?Hint: No. Write a function that takes two PMFs and returns the probability that a value drawn from the first distribution will be greater than a value from the second distribution.Download ## Distribution of percentiles?Suppose you and your classmates compute the percentile rank of your birth weights and then compute the CDF of the percentile ranks. What do you expect it to look like?Hint: what fraction of the class do you expect to be above the median?How does this lead us to an algorithm for generating random numbers from an arbitrary CDF? ## Python styleYou should almost certainly adopt the style guidelines here: http://www.python.org/dev/peps/pep-0008/
In addition, I recommend the style guidelines here: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html
## myplot.pyTake a look at myplot.py (documentation at myplot.html).
Here's an example of how to use myplot.Plot
`import myplot` `import matplotlib.pyplot as pyplot` ` pyplot.clf()` ` pyplot.plot(xs, ps)` ` myplot.Plot('expo_cdf',` ` title='Exponential CDF',` ` xlabel='x',` ` ylabel='CDF',` ` legend=False)` Generates files named expo_cdf.eps and expo_cdf.png
Note that homework 4 asks you to generate EPS files and put them in the shared directory.
## One more Bayes's Theorem problemHints: About 2% of the world population has red hair. You can assume that the alleles for red hair are purely recessive. Also, you can assume that the Red Hair Extinction theory is false, so you can apply the Hardy–Weinberg principle. |

Lecture notes >