Chapter 6. Probability Density Functions
In the previous chapter, we modeled data with theoretical distributions including the binomial, Poisson, exponential, and normal distributions.
The binomial and Poisson distributions are discrete, which means that the outcomes have to be distinct or separate elements, like an integer number of hits and misses, or goals scored. In a discrete distribution, each outcome is associated with a probability mass.
The exponential and normal distribution are continuous, which means the outcomes can be at any point in a range of possible values. In a continuous distribution, each outcome is associated with a probability density. Probability density is an abstract idea, and many people find it difficult at first, but we’ll take it one step at a time. As a first step, let’s think again about comparing distributions.
Comparing Distributions
In the previous chapter, when we compared discrete distributions, we used a bar plot to show their probability mass functions (PMFs). When we compared continuous distributions, we used a line plot to show their cumulative distribution functions (CDFs).
For the discrete distributions, we could also have used CDFs. For example, here’s the PMF of a Poisson distribution with lam=2.2, which is a good model for the distribution of household size in the NSFG data.
We can use read_fem_resp to read the respondent data file:
fromnsfgimportread_fem_respresp=read_fem_resp()
Next we’ll select household sizes for people ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access