liveBook · Manning

Scipy.stats.norm.cdf

As explained in Grokking Statistics

A SciPy function that returns the cumulative distribution function value for a normal distribution.

scipy.stats.norm.cdf() returns the area under a normal-distribution curve from negative infinity up to a chosen value x. Pass x, the mean, and the standard deviation. section 4.5

Use the function to answer probability questions:

  • Find the probability below an upper bound: norm.cdf(63, 64, 3) returns 0.3694. section 4.5
  • Find a middle range by subtracting cumulative areas: norm.cdf(63, 64, 3) - norm.cdf(61, 64, 3) returns 0.2108, or 21.08%. section 4.5

Golden retriever weights

Assuming weights have mean 64 pounds and standard deviation 3 pounds, calculate the chance of a dog weighing between 61 and 63 pounds by subtracting the two CDF values. The result is about 21.08%. section 4.5

from scipy.stats import norm

mu, sigma = 64, 3
area = norm.cdf(63, mu, sigma) - norm.cdf(61, mu, sigma)

print(f"Area between 61 and 63: {area:.4f}")
# Area between 61 and 63: 0.2108

The listing shows the complete two-call subtraction used to calculate the probability between 61 and 63 pounds. section 4.5

How Grokking Statistics covers it

How deep it goes
Explains cumulative area, interprets results, and demonstrates subtraction, but does not derive the CDF internally.
Examples
Uses golden retriever weights, a 64-pound mean, a 3-pound standard deviation, and the 61-to-63-pound interval.
What it assumes
Assumes familiarity with a normal distribution’s mean and standard deviation while explaining cumulative area from zero.
What you can do after
Apply it via SciPy to compute and interpret cumulative or interval probabilities for a normal distribution.
How it connects
Connects the cumulative distribution function with normal distributions, probability density functions, and areas under curves.

Also explained in

Compare how 2 books explain scipy.stats.norm.cdf →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Statistics. The section links point to the parts of the book it draws on.