Statistics Quest

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.

F(x)=P(X≤x),S(x)=P(X>x)=1−F(x)F(x) = P(X \le x), \qquad S(x) = P(X > x) = 1 - F(x)
Cumulative distribution function (cdf) and survival function (sf)
XX
the random variable
F(x)F(x)
probability of a value at most xx (lower tail)
S(x)S(x)
probability of a value strictly greater than xx (upper tail). For discrete variables S(k)=P(X>k)S(k) = P(X > k), so P(X≥k)=S(k−1)P(X \ge k) = S(k-1).
E⁡(X)=∑xx p(x)   or   ∫x f(x) dx,Var⁡(X)=E⁡[(X−μ)2]=E⁡(X2)−μ2\E(X) = \sum_x x\,p(x) \;\text{ or }\; \int x\,f(x)\,dx, \qquad \Var(X) = \E\big[(X-\mu)^2\big] = \E(X^2) - \mu^2
Mean and variance of a distribution
p(x)p(x)
probability mass function (discrete): p(x)=P(X=x)p(x) = P(X = x)
f(x)f(x)
probability density function (continuous): areas under it are probabilities
μ\mu
the mean E⁡(X)\E(X)
Q(p)=min⁡{x:F(x)≥p}Q(p) = \min\{x : F(x) \ge p\}
Quantile (inverse cdf)
pp
a probability between 0 and 1
Q(p)Q(p)
the smallest value whose cdf reaches pp (for continuous distributions, the value with exactly pp 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 P(X=x)=0P(X = x) = 0 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, P(X≥3)=1−P(X≤2)=S(2)P(X \ge 3) = 1 - P(X \le 2) = S(2), not S(3)S(3). "At least" and "more than" differ by one value.
  • For a continuous variable, ≤\le and << give the same probability; for a discrete one they do not.
  • Reading a density height as a probability.

Example

A fair die: p(x)=1/6p(x) = 1/6 for x=1,…,6x = 1, \dots, 6. F(2)=2/6≈0.333F(2) = 2/6 \approx 0.333, S(4)=P(X>4)=2/6S(4) = P(X > 4) = 2/6, mean =3.5= 3.5, variance =91/6−3.52≈2.917= 91/6 - 3.5^2 \approx 2.917.