Probability Basics
Probability is the language of uncertainty, and every statistical method is built on it. Getting the basic rules right — especially conditioning and independence — is what keeps a diagnostic-test calculation or a risk estimate from going badly wrong.
Sample space and events
An experiment has a set of possible outcomes called the sample space . An event is any subset . For a single die roll, and “roll even” is the event .
A probability assigns each event a number measuring how likely it is.
The axioms
Probability obeys three rules (Kolmogorov’s axioms):
- Non-negativity: for every event .
- Normalization: .
- Additivity: if and are disjoint (), then .
Everything else follows. The complement rule is immediate:
The union (inclusion–exclusion) rule
When events can overlap, simply adding probabilities double-counts the overlap:
Conditional probability
The probability of given that occurred rescales to the world where is true:
Rearranging gives the multiplication rule .
Independence
Two events are independent if knowing one tells you nothing about the other. Equivalently,
which we write . Under independence .
Bayes’ theorem
Flipping the direction of conditioning:
Worked example: a diagnostic test
A disease has prevalence . A test has sensitivity and specificity (so the false-positive rate is ). If someone tests positive, what is ?
First get by the law of total probability:
Then apply Bayes:
Even with a “99% accurate” test, a positive result means only a 16.7% chance of disease — because the disease is rare. This base-rate effect is central to screening in epidemiology.
Simulation
We estimate a probability by Monte Carlo: simulate the process many times and take the long-run fraction. Here we estimate for two fair dice (true value ).
R
set.seed(42)
N <- 1e6
d1 <- sample(1:6, N, replace = TRUE)
d2 <- sample(1:6, N, replace = TRUE)
mean(d1 + d2 == 7) # ~0.1667
Python
import numpy as np
rng = np.random.default_rng(42)
N = 1_000_000
d1 = rng.integers(1, 7, N)
d2 = rng.integers(1, 7, N)
print(np.mean(d1 + d2 == 7)) # ~0.1667
0.166807
Julia
using Random, Statistics
Random.seed!(42)
N = 1_000_000
d1 = rand(1:6, N)
d2 = rand(1:6, N)
mean(d1 .+ d2 .== 7) # ~0.1667
Why it matters for statistics
Probability is the machinery under every inference. Conditional probability and Bayes’ theorem drive diagnostic reasoning and Bayesian estimation; independence justifies multiplying likelihoods across observations; the union and complement rules underlie every calculation of error rates and p-values. Monte Carlo simulation turns a hard analytic probability into a simple counting exercise.