Exact within-between variance decomposition

On this page
  1. Goal and scope
  2. Givens and symbols
  3. Rules and sources
  4. Main derivation
  5. Substeps and lemmas
  6. Reverse audits
  7. Error controls and negative controls
  8. Result and limitations
  9. Verification and source binding

← Guide index · Original MKO

derivation-mko-law-of-total-variance-01 · ocme-new142-reader-adoption-20261021

Goal and scope

Decompose variance in a complete law with a null block.

Nonempty partition cells; divide only on positive-mass cells.

Givens and symbols

  • work
  • G1 — Omega={a,b,c,d,e} has masses(1/8,3/8,1/4,1/4,0), X=(0,2,4,4,99); B1={a,b}, B2={c,d}, B0={e}, and G is their generated sigma-algebra.
  • m_i,v_i — cell mean and variance
  • μ — global mean

Rules and sources

Some rule statements have reader clarifications in this revision: they are paraphrases, not verbatim quotations. Referenced original source bytes and hashes are unchanged.

  • mko_definition · cited — Var(X)=E[Var(X|G)]+Var(E[X|G]). Partition cells are pairwise disjoint, nonempty and cover every outcome; a zero-mass cell is still a nonempty event consisting of zero-mass outcomes. Cell means and variances use the same law, with division only on positive-mass cells. Null-cell conditional versions are determined only almost surely and their outer weighted contribution is 0. Neither term may be omitted or have its meaning exchanged. No independence of partition events is required. · mko-law-of-total-variance
  • work · prerequisite — Finite total expectation, centered second moments and square expansion; E[X-m_i|B_i]=0 on each positive-mass cell.

Main derivation

S01 · implies

Before

B_1=\{a,b\},B_2=\{c,d\},B_0=\{e\}

After

(P(B_1),P(B_2),P(B_0))=(1/2,1/2,0)

Conditions: none

Rule: work · Uses: G1, work

Leaf basis: work

The three nonempty blocks are disjoint and exhaustive; B0 contains null atom e.

S02 · implies

Before

E[X]=2(3/8)+4(1/4+1/4)

After

\mu=11/4

Conditions: none

Rule: work · Uses: G1, S01, work

Leaf basis: work

Fix the global center under this law first.

S03 · implies

Before

E[X^2]=4(3/8)+16(1/4+1/4)

After

\operatorname{Var}(X)=19/2-(11/4)^2=31/16

Conditions: none

Rule: work · Uses: G1, S02, work

Leaf basis: work

Obtain global variance independently from the complete second moment.

S04 · implies

Before

P(a\mid B_1)=1/4,\ P(b\mid B_1)=3/4

After

m_1=3/2,\quad v_1=(1/4)(3/2)^2+(3/4)(1/2)^2=3/4

Conditions: none

Rule: work · Uses: G1, S03, work

Leaf basis: work

Normalize the first block, then use its own mean for its variance.

S05 · implies

Before

X|_{B_2}=4

After

m_2=4,\quad v_2=0

Conditions: none

Rule: work · Uses: G1, S04, work

Leaf basis: work

The second block is constant, so its conditional variance is zero.

S06 · implies

Before

E[\operatorname{Var}(X\mid G)]

After

(1/2)(3/4)+(1/2)0=3/8

Conditions: none

Rule: work · Uses: G1, S05, work

Leaf basis: work

The within term is the outer weighted average of cell variances.

S07 · implies

Before

\operatorname{Var}(E[X\mid G])

After

\tfrac12(3/2-11/4)^2+\tfrac12(4-11/4)^2=25/16

Conditions: none

Rule: work · Uses: G1, S06, work

Leaf basis: work

The between term uses the global center for the variance of the two cell means.

S08 · implies

Before

X-\mu=(X-m_i)+(m_i-\mu)\quad\text{on }B_i

After

(X-\mu)^2=(X-m_i)^2+2(X-m_i)(m_i-\mu)+(m_i-\mu)^2

Conditions: none

Rule: work · Uses: G1, S07, work

Leaf basis: work

Expand the square on each cell, retaining both squares and the cross term.

S09 · implies

Before

E[X-m_i\mid B_i]=m_i-m_i=0

After

E[(X-\mu)^2\mid B_i]=v_i+(m_i-\mu)^2

Conditions: none

Rule: work · Uses: G1, S08, work

Leaf basis: work

Factor out the cell constant m_i-mu; the cross term is 2(m_i-mu) times zero.

S10 · implies

Before

\sum_{i:P(B_i)>0}P(B_i)E[(X-\mu)^2\mid B_i]

After

\operatorname{Var}(X)=\sum_iP(B_i)v_i+\sum_iP(B_i)(m_i-\mu)^2=3/8+25/16=31/16

Conditions: none

Rule: work · Uses: G1, S09, work

Leaf basis: work

Weight over the complete partition; the first sum is within and the second between.

Substeps and lemmas

No substeps in this guide.

Reverse audits

  • S10 · premise_audit · G1, S09, work — Both terms match the direct31/16; no independence assumption eliminated the cross term.
  • S09 · premise_audit · G1, S08, work — Take conditional quotients only on positive-mass cells; null cells have zero outer weighted contribution.
  • S08 · premise_audit · G1, S07, work — The coefficient 2 is required and m_i is constant within the cell.
  • S07 · premise_audit · G1, S06, work — The null version is weighted by zero and cannot change this term.
  • S06 · premise_audit · G1, S05, work — This term is not the variance of the cell means.
  • S05 · premise_audit · G1, S04, work — Null-block mean and variance remain version choices, with no division by zero.
  • S04 · premise_audit · G1, S03, work — Centering at global11/4 would not give the cell variance.
  • S03 · premise_audit · G1, S02, work — The squared mean is 121/16, not a new weighted moment.
  • S02 · premise_audit · G1, S01, work — The value 99 at e is weighted by zero.
  • S01 · premise_audit · G1, work — The empty set is not the specified null cell.

Error controls and negative controls

Cell center

Use3/2, not 11/4, for the B1 variance.

Cross term

Eliminate it using zero conditional mean, not an independence assumption.

  • The within term3/8 is sufficient. → reject — Different cell means contribute the additional25/16.
  • B0 can be replaced by the empty set. → reject — Here B0={e}; the partition must cover the whole carrier.
  • Within means the variance of cell means. → reject — That is between; within averages cell variances.

Result and limitations

Global variance 31/16 equals within3/8 plus between25/16.

    Verification and source binding

    3 declared checks for this guide; only the listed expressions are covered.

    • source commit: b1b2f1dcf8c50d67a93fe52d95f8eef7b3abba9f
    • adopted source SHA-256: 668efe3c54e9427c01450e0e91f89eb655c95d12eb112772605e6dee4a187fe5
    • original source SHA-256: d743eb39e9043e0455cec097334446bb62dc2ae0f693eb96b73f9a4a55b92452
    • Lean: NOT_RUN · independent AI: SCOPED_LEAD_AND_BILINGUAL_CONTEXT_REVIEW

    Same-source full JSON (formulas, ASTs, controls and revision log)