Law of total variance in and

Var(Y) = E(Var(Y|X)) + Var(E(Y|X)).

Informally speaking this can be viewed as the sum of the "unexplained" portion of Var(Y) and the portion of Var(Y) which is "explained" by X.

A generalization is the law of total covariance:

Cov(X, Y) = E(Cov(X, Y | Z) + Cov(E(X | Z), E(Y | Z)).

(the law of total variance corresponds to the case X=Y)

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!