In this lesson

Wide tables, equations, and code scroll sideways. Swipe, or Tab to focus them and use the left and right arrow keys.

Joint and marginal distributions

A joint distribution describes two or more variables together. A two-way table is often the clearest place to start. Each interior cell below is a probability for both a group and an outcome; all four interior cells sum to one.

Joint probabilities: each cell is a share of the whole population
GroupSuccessFailureMarginal
A24.00%6.00%30.00%
B14.00%56.00%70.00%
Total38.00%62.00%100%

P(success | A) = 80.00%; P(A | success) = 63.16%.

Set both success rates equal to make group and success independent. Changing group sizes can change the overall rate without changing either within-group rate.

Marginals add across the other variable

Initially, 30% of the population is in group A. Within A, 80% succeed, giving joint probability P(A and success) = 0.30 × 0.80 = 0.24. Within B, 20% succeed, contributing 0.70 × 0.20 = 0.14.

Adding across groups gives the marginal probability of success: 0.24 + 0.14 = 0.38. This is a weighted average of the within-group rates. It is not their unweighted average of 50%, because the groups have different sizes.

Condition by dividing

To recover the success rate within A, divide the joint cell by A’s marginal: 0.24/0.30 = 0.80. To ask what fraction of successful people belong to A, use a different denominator: 0.24/0.38 ≈ 0.632.

Both calculations use the same joint cell. The question determines the denominator. If the conditioning event has probability zero, the elementary ratio is undefined; the table explicitly reports that boundary case.

Make a prediction

Can the overall success rate rise while neither group's success rate changes?

Explore the answer

Yes. Increase the share in A while holding both success rates fixed. Since A’s rate is higher, shifting weight toward it raises the aggregate rate. No within-group improvement is necessary.

Independence has a visible signature

Set both success rates to the same value. The conditional probability of success is now the same in A and B, and equals the marginal probability. Group and success are independent in this model.

In a larger joint table, independence requires this relationship across all values: every joint probability must equal the product of its marginals. A correlation of zero is a weaker statement and can miss nonlinear dependence.

Aggregation does not settle causation

A changed aggregate may reflect changed group weights, changed within-group rates, or both. Simpson’s paradox shows a reversal between aggregate and within-group comparisons.

That does not imply “always control for every available group”. Which variables to condition on depends on how the data were generated and which causal question is being asked. The table is descriptive; an intervention claim needs assumptions beyond the displayed probabilities.

Continue with conditioning, Bayes’ theorem, and Simpson’s paradox.

Further reading

ProbabilityCourse: formal definitions and worked examples.

Reset all settings