253 lines
4.1 KiB
Markdown
253 lines
4.1 KiB
Markdown
---
|
||
title: "Conditional variance"
|
||
chunk: 2/2
|
||
source: "https://en.wikipedia.org/wiki/Conditional_variance"
|
||
category: "reference"
|
||
tags: "science, encyclopedia"
|
||
date_saved: "2026-05-05T12:22:02.721176+00:00"
|
||
instance: "kb-cron"
|
||
---
|
||
|
||
=== Definition using conditional distributions ===
|
||
The "conditional expectation of Y given X=x" can also be defined more generally
|
||
using the conditional distribution of Y given X (this exists in this case, as both here X and Y are real-valued).
|
||
In particular, letting
|
||
|
||
|
||
|
||
|
||
P
|
||
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
|
||
|
||
|
||
|
||
{\displaystyle P_{Y|X}}
|
||
|
||
be the (regular) conditional distribution
|
||
|
||
|
||
|
||
|
||
P
|
||
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
|
||
|
||
|
||
|
||
{\displaystyle P_{Y|X}}
|
||
|
||
of Y given X, i.e.,
|
||
|
||
|
||
|
||
|
||
P
|
||
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
|
||
|
||
:
|
||
|
||
|
||
B
|
||
|
||
|
||
×
|
||
|
||
R
|
||
|
||
→
|
||
[
|
||
0
|
||
,
|
||
1
|
||
]
|
||
|
||
|
||
{\displaystyle P_{Y|X}:{\mathcal {B}}\times \mathbb {R} \to [0,1]}
|
||
|
||
(the intention is that
|
||
|
||
|
||
|
||
|
||
P
|
||
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
|
||
|
||
(
|
||
U
|
||
,
|
||
x
|
||
)
|
||
=
|
||
P
|
||
(
|
||
Y
|
||
∈
|
||
U
|
||
|
||
|
|
||
|
||
X
|
||
=
|
||
x
|
||
)
|
||
|
||
|
||
{\displaystyle P_{Y|X}(U,x)=P(Y\in U|X=x)}
|
||
|
||
almost surely over the support of X), we can define
|
||
|
||
|
||
|
||
|
||
Var
|
||
|
||
(
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
=
|
||
x
|
||
)
|
||
=
|
||
∫
|
||
|
||
|
||
(
|
||
|
||
y
|
||
−
|
||
∫
|
||
|
||
y
|
||
′
|
||
|
||
|
||
P
|
||
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
|
||
|
||
(
|
||
d
|
||
|
||
y
|
||
′
|
||
|
||
|
||
|
|
||
|
||
x
|
||
)
|
||
|
||
)
|
||
|
||
|
||
2
|
||
|
||
|
||
|
||
P
|
||
|
||
Y
|
||
|
||
|
|
||
|
||
X
|
||
|
||
|
||
(
|
||
d
|
||
y
|
||
|
||
|
|
||
|
||
x
|
||
)
|
||
.
|
||
|
||
|
||
{\displaystyle \operatorname {Var} (Y|X=x)=\int \left(y-\int y'P_{Y|X}(dy'|x)\right)^{2}P_{Y|X}(dy|x).}
|
||
|
||
|
||
This can, of course, be specialized to when Y is discrete itself (replacing the integrals with sums), and also when the conditional density of Y given X=x with respect to some underlying distribution exists.
|
||
|
||
== Components of variance ==
|
||
The law of total variance says
|
||
|
||
|
||
|
||
|
||
Var
|
||
|
||
(
|
||
Y
|
||
)
|
||
=
|
||
E
|
||
|
||
(
|
||
Var
|
||
|
||
(
|
||
Y
|
||
∣
|
||
X
|
||
)
|
||
)
|
||
+
|
||
Var
|
||
|
||
(
|
||
E
|
||
|
||
(
|
||
Y
|
||
∣
|
||
X
|
||
)
|
||
)
|
||
.
|
||
|
||
|
||
{\displaystyle \operatorname {Var} (Y)=\operatorname {E} (\operatorname {Var} (Y\mid X))+\operatorname {Var} (\operatorname {E} (Y\mid X)).}
|
||
|
||
|
||
In words: the variance of Y is the sum of the expected conditional variance of Y given X and the variance of the conditional expectation of Y given X. The first term captures the variation left after "using X to predict Y", while the second term captures the variation due to the mean of the prediction of Y due to the randomness of X.
|
||
|
||
== See also ==
|
||
Mixed model
|
||
Random effects model
|
||
|
||
== References ==
|
||
|
||
== Further reading ==
|
||
Casella, George; Berger, Roger L. (2002). Statistical Inference (Second ed.). Wadsworth. pp. 151–52. ISBN 0-534-24312-6. |