A few algebraic identities simplify many probability calculations. Keeping the parameter conventions visible is just as important as remembering the function names.
Series and approximations
The first approximation is Stirling’s formula. The harmonic-number constant is Euler’s constant, . Here is the natural logarithm. These formulas describe large- behavior, not exact equalities for finite .
Gamma and beta integrals
Recognizing a normalized density inside an integral can save a long integration. First isolate its normalizing constant, then check that the integration limits match its support.
Distribution relationships worth recognizing
- is Bernoulli; is geometric under the failure-count convention.
- is uniform on ; is exponential.
- is gamma with shape and rate .
- Independent binomials with a common success probability add their trial counts. Independent negative binomials with a common success probability add their required success counts.
- Independent Poisson variables add their means; independent gamma variables with a common rate add their shapes; independent normal variables add their means and variances.
A useful conditional relationship: if independent and share the same , then given , is hypergeometric with population size , labeled successes, and sample size .
Probability calculations in R
| Prefix | Meaning | Example |
|---|---|---|
| d | Probability mass or density | dbinom, dnorm |
| p | CDF: probability at or below a value | pbinom, pnorm |
| q | Quantile | qbinom, qnorm |
| r | Random sample | rbinom, rnorm |
The prefixes have different jobs. A normal density value returned by dnorm is not a point probability. For an upper tail, lower.tail = FALSE returns the probability strictly above the supplied cutoff.
# X ~ Binomial(12, 0.25)
dbinom(3, size = 12, prob = 0.25) # P(X = 3)
pbinom(2, size = 12, prob = 0.25,
lower.tail = FALSE) # P(X >= 3)
# Standard normal probabilities and quantiles
pnorm(1.96) - pnorm(-1.96) # About 0.95
qnorm(0.975) # About 1.96
# Reproducible random draws
set.seed(42)
rexp(5, rate = 2)
rgamma(5, shape = 3, rate = 2)
rbeta(5, shape1 = 2, shape2 = 5)
# Three marked objects in four draws without replacement
# Population: six marked, fourteen unmarked
dhyper(3, m = 6, n = 14, k = 4)R’s normal functions take sd, not variance. For gamma sampling, specify rate or scale deliberately. R’s geometric and negative binomial functions count failures. Use dmultinom or rmultinom for multinomial probabilities or samples.
R stats documentation: distribution functions and their parameter conventions
Sources and further study
This article adapts the topics in Probability Cheatsheet by William Chen and Joe Blitzstein, with rewritten explanations, reorganized sections, and new examples. The adapted notes are shared under the same Creative Commons Attribution–NonCommercial–ShareAlike 4.0 license.