Probability distributions: PDF, CDF and inverse CDF explained

Updated

A probability distribution describes how likely each value of a random quantity is: the weight of the next bottle, the number of defective parts in a sample, the t statistic of a test. Three functions answer the questions engineers ask of it. The PDF gives the density at a value (for counts, the probability of exactly that count). The CDF gives the probability of a value at or below x. The inverse CDF turns a probability back into a value, such as a percentile or a critical value. Six distributions cover most quality work: normal, t, chi-square, F, binomial and Poisson.

When to use it

  • Estimate the share of parts outside a specification from the process mean and standard deviation.
  • Find critical values for confidence intervals and tests, such as the t value for a 95% interval.
  • Compute a p-value by hand from a test statistic.
  • Work out the chance of finding k defective parts in a sample, or k defects on a unit.
  • Generate random data from a distribution through its inverse CDF.

How it works

For a value x and a lower-tail probability p:

PDF: f(x) (for counts: P(X = k)) CDF: F(x) = P(X ≤ x) Upper tail: P(X > x) = 1 − F(x) Inverse CDF: x = F⁻¹(p), the value with probability p at or below it

For counts, "at least k" is 1 − F(k − 1). The six distributions and what they are for:

DistributionParametersTypical useFormula names
Normalmean, standard deviationMeasurements; share out of specificationNORMPDF, NORMCDF, NORMINV
tdegrees of freedomMeans when σ is estimated; t-tests, intervalsTPDF, TCDF, TINV
Chi-squaredegrees of freedomVariances; tests on countsCHISQPDF, CHISQCDF, CHISQINV
Fnumerator and denominator dfRatio of two variances; ANOVAFPDF, FCDF, FINV
Binomialn trials, probability pDefective parts in a sampleBINOMPDF, BINOMCDF, BINOMINV
PoissonmeanDefects per unit, events per periodPOISSONPDF, POISSONCDF, POISSONINV

StatLab also has the lognormal, exponential, Weibull and gamma distributions for lifetimes and skewed measurements, the beta for proportions, and the uniform and integer distributions for simulations, with the formula names LOGNORM…, EXPON…, WEIBULL…, GAMMA…, BETA… and UNIF….

In StatLab, Calc › Probability distributions computes any of these for values you type or for a whole column, and the same functions work in the calculator (row by row on a column) and the super calculator (Ctrl+K, one answer at a time). The arguments are NORMCDF(x, mean, sd), NORMINV(p, mean, sd) (leave out mean and sd for the standard normal), TCDF(x, df), TINV(p, df), CHISQCDF(x, df), CHISQINV(p, df), FCDF(x, df1, df2), FINV(p, df1, df2), BINOMPDF(k, n, p), BINOMCDF(k, n, p), POISSONPDF(k, mean) and POISSONCDF(k, mean). Every CDF gives the lower tail and every inverse takes a lower-tail probability, so a two-sided 95% value uses 0.975. Some older spreadsheet functions with similar names are two-sided or upper-tail; check which convention a source uses.

Example

Normal: share out of specification. A filler runs at a mean of 500.4 g with a standard deviation of 0.3 g; the limits are 499.5 and 501.2 g.

  • Below 499.5: NORMCDF(499.5, 500.4, 0.3) = 0.00135, which is 1,350 parts per million. The limit is 3 standard deviations below the mean.
  • Above 501.2: 1 - NORMCDF(501.2, 500.4, 0.3) = 0.00383, or 3,830 ppm (2.67 standard deviations above).
  • Total: about 5,180 ppm out of specification. Centering the process would cut this.
  • The 99.9th percentile: NORMINV(0.999, 500.4, 0.3) = 501.33 g.

t: a confidence interval and a p-value. Ten parts have a mean of 12.40 and a standard deviation of 0.85. TINV(0.975, 9) = 2.262, so the 95% interval for the mean is 12.40 ± 2.262 × 0.85 / √10 = 12.40 ± 0.61, from 11.79 to 13.01. A test statistic of t = 2.5 with 9 degrees of freedom has a two-sided p-value of 2 * (1 - TCDF(2.5, 9)) = 0.034.

Chi-square: an interval for σ. Twenty parts give s = 0.12. With 19 degrees of freedom, CHISQINV(0.025, 19) = 8.907 and CHISQINV(0.975, 19) = 32.852. The 95% interval for σ runs from √(19 × 0.12² / 32.852) = 0.091 to √(19 × 0.12² / 8.907) = 0.175. Small samples pin down σ only loosely.

F: an ANOVA critical value. A one-way ANOVA with 4 groups and 20 observations has 3 and 16 degrees of freedom. FINV(0.95, 3, 16) = 3.239 is the 5% critical value. An observed F of 4.2 has a p-value of 1 - FCDF(4.2, 3, 16) = 0.023.

Binomial: defectives in a sample. A process makes 2% defective parts, and an inspector checks 50:

  • No defectives: BINOMPDF(0, 50, 0.02) = 0.364.
  • At most 2: BINOMCDF(2, 50, 0.02) = 0.922, so 3 or more happens with probability 0.078.
Binomial probabilities, n = 50, p = 0.020.00.10.20.30.4Probability of exactly k defectives0123456
Binomial probabilities, n = 50, p = 0.02

A sample of 50 finds no defectives more than a third of the time even though 1 part in 50 is bad. That is why small samples cannot prove a low defect rate.

Poisson: defects per unit. Painted panels average 1.5 surface defects each. The chance of a perfect panel is POISSONPDF(0, 1.5) = 0.223. The chance of 4 or more defects is 1 - POISSONCDF(3, 1.5) = 0.066, about one panel in 15.

How to read the results

  • CDF values are lower-tail probabilities. Subtract from 1 for the upper tail, and double the smaller tail for a two-sided p-value of a symmetric statistic.
  • Inverse CDF values are cut-offs. TINV(0.975, df) leaves 2.5% above it; NORMINV(0.999, …) leaves 0.1% above.
  • PDF values of continuous distributions are densities, not probabilities. Only areas (CDF differences) are probabilities.
  • The model matters. A normal CDF predicts tails well only if the process really is close to normal; check with a probability plot.

Common mistakes

  • Using 0.95 instead of 0.975 for a two-sided 95% critical value.
  • Off-by-one errors with counts. P(X ≥ 3) is 1 − BINOMCDF(2, …), not 1 − BINOMCDF(3, …).
  • Mixing up the F degrees of freedom. The numerator df comes first.
  • Using the normal for small-sample means. With an estimated σ, use t; the difference is large below about 30 values.
  • Treating ppm from a normal fit as exact. Tail estimates are sensitive to the shape of the distribution and to the uncertainty in the mean and standard deviation.

Frequently asked questions

What is the difference between a PDF and a CDF?

The PDF gives the density at a point (for counts, the probability of exactly that count). The CDF accumulates it: the probability of a value at or below x. The CDF is what you use for "what share is below this limit?".

What is an inverse CDF used for?

To turn a probability into a value: percentiles, critical values for tests and intervals, and random numbers from uniform ones.

Can I compute these in StatLab today?

Yes. Calc › Probability distributions gives densities, cumulative probabilities and inverses for 13 distributions, and the same functions work in formulas in the calculator and the super calculator. They are checked against reference values to at least 12 significant digits. To see an area, draw it with a distribution plot.

When should I use the binomial and when the Poisson?

Use the binomial for the number of defective items among n inspected, each either good or bad. Use the Poisson for the number of defects or events in a fixed unit of space or time, where there is no fixed maximum.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab