A cumulative distribution function (CDF) answers a threshold question: how probable is it that a random variable is at or below a chosen value? For a continuous variable, it accumulates the area under the probability density function (PDF) from negative infinity through that threshold. section 3.8
Use one CDF to calculate several useful probabilities:
- CDF(x) gives the probability that the variable is less than or equal to x. section 3.8
- 1 − CDF(x) gives the probability that the variable exceeds x. section 3.8
- CDF(upper) − CDF(lower) gives the probability that the variable lies between two thresholds. section 3.8
Posterior threshold questions
Suppose a beta posterior describes the proportion of coworkers who prefer tea. To estimate the probability that the proportion exceeds 0.8, calculate 1 − beta.cdf(0.8, post_a, post_b), which returns about 0.09888 in the example. For the probability between 0.2 and 0.4, subtract beta.cdf(0.2, post_a, post_b) from beta.cdf(0.4, post_a, post_b), obtaining about 0.16224. section 3.8
from scipy.stats import beta 1 - beta(a, b).cdf(0.1)
Use the SciPy listing to evaluate a posterior tail probability directly; the same pattern answers whether a conversion rate exceeds 0.1. section 11.10




