§3.4 Marginal probability
Given a joint distribution over several variables, the distribution of just a subset is the marginal probability marginal probability The distribution of a subset of variables: P(x) = Σ_y P(x,y) (sum rule) or the integral analogue. defined in ch. 3 — open in glossary distribution, found with the sum rule:
Term by term
| the joint — how likely each COMBINATION of states is | a grid of numbers | |
| sum a whole row: every way y could turn out while x = x | collapse one axis | |
| the marginal — written, historically, in the MARGIN of the paper grid; hence the name | one number per row |
(Continuous variables integrate instead: .) The etymology is literal — try it:
click a row label to condition on it — the margins already show both marginals
§3.5 Conditional probability
The probability of an event given that another has happened is a conditional probability conditional probability P(y|x) = P(y,x)/P(x), defined when P(x) > 0; NOT the same as computing an intervention's consequences. defined in ch. 3 — open in glossary :
Term by term
| how often y AND x happen together | joint cell | |
| how often the condition happens at all — must be > 0, or the conditional is undefined | row marginal | |
| zoom into the world where x happened, renormalize so that world sums to 1 | renormalized row |
In the widget above, clicking a row performs exactly this renormalization.
Aside — conditioning is not intervening
P(German citizen | speaks German) is high — but teaching a random person German does not move them to Germany. Computing the consequences of an action is an intervention query, the domain of causal modeling, which this book does not cover. Conditioning only filters observations.
§3.6 The chain rule of conditional probabilities
Any joint distribution factors into one-variable conditionals — the chain rule chain rule of probability Any joint factors into one-variable conditionals: P(x⁽¹⁾…x⁽ⁿ⁾) = P(x⁽¹⁾) Π P(x⁽ⁱ⁾|x⁽¹⁾…x⁽ⁱ⁻¹⁾). defined in ch. 3 — open in glossary (or product rule): . It falls straight out of the definition, applied repeatedly:
step 1/3: Apply the conditional-probability definition once, treating (b, c) as a block.
§3.7 Independence and conditional independence
Two variables are independent independence x⊥y: the joint factorizes p(x,y) = p(x)p(y); stronger than zero covariance (excludes nonlinear relations too). defined in ch. 3 — open in glossary () when their joint factorizes: for every pair of values — the grid becomes an outer product of its margins (flip the widget above to its independent version: same marginals, different joint!). They are conditionally independent conditional independence x⊥y|z: the joint over x,y factorizes given every value of z. defined in ch. 3 — open in glossary given () when the factorization holds within every slice .
§3.8 Expectation, variance and covariance
The expectation expectation E_{x∼P}[f(x)] = Σ P(x)f(x) (or integral): the average of f under P; linear. defined in ch. 3 — open in glossary (expected value) of under is the average value takes when is drawn from :
Expectation — the average under a distribution
| any function of the random variable | per-state value | |
| the weight each state contributes | probability | |
| LINEAR: E[αf + βg] = αE[f] + βE[g] — the property everything later leans on | weighted average |
The variance variance E[(f(x) − E[f(x)])²]: spread around the mean; its square root is the standard deviation. defined in ch. 3 — open in glossary measures spread around the mean (low variance = values cluster); its square root is the standard deviation. The covariance covariance E[(f(x)−E f)(g(y)−E g)]: linear co-variation and scale; correlation normalizes the scale away. defined in ch. 3 — open in glossary measures linear co-variation (and carries the variables’ scales; correlation normalizes the scales away).
Worked example — a two-coin expectation
Let be a die roll, . Then , and , so the standard deviation is : rolls typically land a couple of pips from 3.5.
Covariance is NOT dependence. Independence ⟹ zero covariance, and nonzero covariance ⟹ dependence — but zero covariance does not imply independence, because covariance only sees linear relationships:
x fully determines the magnitude of y — maximal dependence — yet the two branches cancel: Cov(x, y) = 0. Independence is the stronger property; it excludes nonlinear relationships too.
For a random vector , the covariance matrix covariance matrix For random vector x ∈ ℝⁿ: Cov(x)_{i,j} = Cov(xᵢ, xⱼ); variances on the diagonal. defined in ch. 3 — open in glossary collects everything: , with the variances on the diagonal — the object the multivariate Gaussian is built around.
§3.9.1 The Bernoulli distribution
The Bernoulli distribution bernoulli distribution Single binary variable with P(x=1) = φ; mean φ, variance φ(1−φ). defined in ch. 3 — open in glossary covers a single binary variable via one parameter : , — compactly — with and :
mean = φ = 0.70, variance = φ(1−φ) = 0.210 (largest at φ = ½)
Check yourself — marginals to Bernoulli
1.In the JointGrid, where does the name 'marginal probability' come from?
2.You click the 'rain' row (marginal 0.40) whose cells are [0.05, 0.15, 0.20]. Predict the conditional P(activity | rain).
3.The widget's independent table has the SAME marginals as the dependent one. What changed?
4.In the y = s·x construction (scatter figure), why is Cov(x, y) = 0 despite total dependence?
5.In the Bernoulli explorer, where is the variance φ(1−φ) largest, and why does that make intuitive sense?