PDF and CDF
Density and area.
For continuous variables, we can't ask for the chance of an exact value. We ask about ranges instead. What's the chance someone is shorter than one eighty? That's an area under the curve.

- No exact values
- Ask about ranges
- Area under the curve
Two functions
The PDF, the probability density function, is the height of the curve. Higher means values there are more common. The CDF, the cumulative distribution function, is the area to the left of a point. So the CDF at one eighty is the chance of being shorter than one eighty.
Areas with scipy
Norm dot CDF gives the chance of being below a value. Subtract two CDFs for a range. And PPF goes backwards. It finds the height that ninety five percent of people are below. Run it. About eighty nine percent are under one eighty, and the ninety fifth percentile is about one eighty three.
from scipy.stats import norm
mu, sigma = 170, 8
print("P(h < 180): ", round(norm.cdf(180, mu, sigma), 4))
between = norm.cdf(180, mu, sigma) - norm.cdf(160, mu, sigma)
print("P(160 < h < 180):", round(between, 4))
print("95th percentile: ", round(norm.ppf(0.95, mu, sigma), 1))P(h < 180): 0.8944 P(160 < h < 180): 0.7887 95th percentile: 183.2
Summary
The PDF is the curve's height, and the CDF is the area to the left. PPF goes from a probability back to a value. Next, checking whether data is really normal.
Key takeaways- norm.cdf for areas
- Subtract for a range
- norm.ppf goes backwards