Random variables: pmf, pdf, cdf, sf and quantiles
A random variable assigns a number to each outcome; its distribution is described by a pmf or pdf, a cdf, a survival function and a quantile function.
- the random variable
- probability of a value at most (lower tail)
- probability of a value strictly greater than (upper tail). For discrete variables , so .
- probability mass function (discrete):
- probability density function (continuous): areas under it are probabilities
- the mean
- a probability between 0 and 1
- the smallest value whose cdf reaches (for continuous distributions, the value with exactly below it)
When to use
- Whenever a quantity is uncertain before it is observed: a count of defects, a waiting time, a test statistic.
- Discrete variables (counts) have a pmf: probabilities sit on separate values. Continuous variables (measurements) have a pdf: probabilities are areas, and for any single value.
How to interpret
- The cdf answers "at most" questions; the sf answers "more than" questions; the quantile function answers "which value cuts off this probability?" (critical values, percentiles).
- A pdf value is a density, not a probability; it can exceed 1.
- Engine convention: for discrete distributions sf(k) = P(X > k) (strictly greater, as in R and SciPy) and quantile(p) is the smallest k with P(X ≤ k) ≥ p. Tails are computed directly, never as 1 − cdf, so tiny p-values keep their precision.
Common mistakes
- For a count, , not . "At least" and "more than" differ by one value.
- For a continuous variable, and give the same probability; for a discrete one they do not.
- Reading a density height as a probability.
Example
A fair die: for . , , mean , variance .