Iz Wikipedije, proste enciklopedije
Kovariančna matrika (oznaka
Σ
{\displaystyle \Sigma \,}
) (tudi variančno-kovariančna matrika) je matrika , katere elementi so kovariance i-tega in j-tega elementa vektorja slučajne spremenljivke .
Označimo z
X
→
{\displaystyle {\vec {X}}\,}
stolpični vektor
X
→
=
[
X
1
⋮
X
n
]
{\displaystyle {\vec {X}}={\begin{bmatrix}X_{1}\\\vdots \\X_{n}\end{bmatrix}}}
kjer so
X
n
{\displaystyle X_{n}\,}
posamezne komponente slučajne spremenljivke , ki imajo končno varianco .
Kovariančna matrika
Σ
{\displaystyle \Sigma \,}
, ki ima za elemente kovariance tako, da je
Σ
i
j
=
c
o
v
(
X
i
,
X
j
)
=
E
[
(
X
i
−
μ
i
)
(
X
j
−
μ
j
)
]
{\displaystyle \Sigma _{ij}=\mathrm {cov} (X_{i},X_{j})=\mathrm {E} {\begin{bmatrix}(X_{i}-\mu _{i})(X_{j}-\mu _{j})\end{bmatrix}}}
kjer je
μ
i
=
E
(
X
i
)
{\displaystyle \mu _{i}=\mathrm {E} (X_{i})\,}
pričakovana vrednost za i-to komponento vektorja
X
{\displaystyle X\,}
.
c
o
v
(
X
i
,
X
j
)
{\displaystyle \mathrm {cov} (X_{i},X_{j})\,}
kovarianca elementov
X
i
{\displaystyle X_{i}\,}
in
X
j
{\displaystyle X_{j}\,}
.
Iz tega sledi, da kovariančno matriko lahko zapišemo kot
Σ
=
[
E
[
(
X
1
−
μ
1
)
(
X
1
−
μ
1
)
]
E
[
(
X
1
−
μ
1
)
(
X
2
−
μ
2
)
]
⋯
E
[
(
X
1
−
μ
1
)
(
X
n
−
μ
n
)
]
E
[
(
X
2
−
μ
2
)
(
X
1
−
μ
1
)
]
E
[
(
X
2
−
μ
2
)
(
X
2
−
μ
2
)
]
⋯
E
[
(
X
2
−
μ
2
)
(
X
n
−
μ
n
)
]
⋮
⋮
⋱
⋮
E
[
(
X
n
−
μ
n
)
(
X
1
−
μ
1
)
]
E
[
(
X
n
−
μ
n
)
(
X
2
−
μ
2
)
]
⋯
E
[
(
X
n
−
μ
n
)
(
X
n
−
μ
n
)
]
]
.
{\displaystyle \Sigma ={\begin{bmatrix}\mathrm {E} [(X_{1}-\mu _{1})(X_{1}-\mu _{1})]&\mathrm {E} [(X_{1}-\mu _{1})(X_{2}-\mu _{2})]&\cdots &\mathrm {E} [(X_{1}-\mu _{1})(X_{n}-\mu _{n})]\\\\\mathrm {E} [(X_{2}-\mu _{2})(X_{1}-\mu _{1})]&\mathrm {E} [(X_{2}-\mu _{2})(X_{2}-\mu _{2})]&\cdots &\mathrm {E} [(X_{2}-\mu _{2})(X_{n}-\mu _{n})]\\\\\vdots &\vdots &\ddots &\vdots \\\\\mathrm {E} [(X_{n}-\mu _{n})(X_{1}-\mu _{1})]&\mathrm {E} [(X_{n}-\mu _{n})(X_{2}-\mu _{2})]&\cdots &\mathrm {E} [(X_{n}-\mu _{n})(X_{n}-\mu _{n})]\end{bmatrix}}.}
.
Obratno matriko kovariančne matrike
Σ
−
1
{\displaystyle \Sigma ^{-1}\,}
imenujejo tudi matrika natančnosti .
Kovariančno matriko imenujemo tudi variančno-kovariančna matrika, ker velja
Σ
X
=
var
(
X
→
)
=
var
(
X
1
⋮
X
p
)
=
(
var
(
X
1
)
cov
(
X
1
X
2
)
⋯
cov
(
X
1
X
p
)
cov
(
X
2
X
1
)
⋱
⋯
⋮
⋮
⋮
⋱
⋮
cov
(
X
P
X
1
)
⋯
⋯
var
(
X
p
)
)
=
(
σ
x
1
2
σ
x
1
x
2
⋯
σ
x
1
x
p
σ
x
2
x
1
⋱
⋯
⋮
⋮
⋮
⋱
⋮
σ
x
p
x
1
⋯
⋯
σ
x
p
2
)
{\displaystyle \Sigma _{X}=\operatorname {var} ({\vec {X}})=\operatorname {var} {\begin{pmatrix}X_{1}\\\vdots \\X_{p}\end{pmatrix}}={\begin{pmatrix}\operatorname {var} (X_{1})&\operatorname {cov} (X_{1}X_{2})&\cdots &\operatorname {cov} (X_{1}X_{p})\\\operatorname {cov} (X_{2}X_{1})&\ddots &\cdots &\vdots \\\vdots &\vdots &\ddots &\vdots \\\operatorname {cov} (X_{P}X_{1})&\cdots &\cdots &\operatorname {var} (X_{p})\end{pmatrix}}={\begin{pmatrix}\sigma _{x_{1}}^{2}&\sigma _{x_{1}x_{2}}&\cdots &\sigma _{x_{1}x_{p}}\\\sigma _{x_{2}x_{1}}&\ddots &\cdots &\vdots \\\vdots &\vdots &\ddots &\vdots \\\sigma _{x_{p}x_{1}}&\cdots &\cdots &\sigma _{x_{p}}^{2}\end{pmatrix}}}
kjer je
var
(
X
→
)
{\displaystyle \operatorname {var} ({\vec {X}})\,}
varianca vektorja
X
→
{\displaystyle {\vec {X}}\,}
cov
{\displaystyle \operatorname {cov} \,}
kovarianca komponent
X
i
{\displaystyle X_{i}\,}
in
X
j
{\displaystyle X_{j}\,}
σ
n
{\displaystyle \sigma _{n}\,}
varianca n-te komponente vektorja (na glavni diagonali so same variance, izven diagonale pa so kovariance). Zaradi tega ima matrika tudi ime variančno-kovariančna matrika .
Zgornja definicija je enakovredna zapisu
Σ
=
E
[
(
X
−
E
[
X
]
)
(
X
−
E
[
X
]
)
⊤
]
{\displaystyle \Sigma =\mathrm {E} \left[\left({\textbf {X}}-\mathrm {E} [{\textbf {X}}]\right)\left({\textbf {X}}-\mathrm {E} [{\textbf {X}}]\right)^{\top }\right]}
.
Ta zapis lahko smatramo za posplošitev skalarne oblike variance na višje razsežnosti.
Pri tem velja za slučajno spremenljivko s skalarnimi vrednostmi
σ
2
=
v
a
r
(
X
)
=
E
[
(
X
−
μ
)
2
]
,
{\displaystyle \sigma ^{2}=\mathrm {var} (X)=\mathrm {E} [(X-\mu )^{2}],\,}
kjer je
μ
=
E
(
X
)
.
{\displaystyle \mu =\mathrm {E} (X).\,}
Za kovariančno matriko
Σ
{\displaystyle \Sigma \,}
Σ
=
E
(
X
X
⊤
)
−
μ
μ
⊤
{\displaystyle \Sigma =\mathrm {E} (\mathbf {XX^{\top }} )-\mathbf {\mu } \mathbf {\mu ^{\top }} }
Σ
{\displaystyle \Sigma \,}
je pozitivno semidefinitna matrika (to pomeni, da je simetrična ).
var
(
A
X
+
a
)
=
A
var
(
X
)
A
⊤
{\displaystyle \operatorname {var} (\mathbf {AX} +\mathbf {a} )=\mathbf {A} \,\operatorname {var} (\mathbf {X} )\,\mathbf {A^{\top }} }
cov
(
X
,
Y
)
=
cov
(
Y
,
X
)
⊤
{\displaystyle \operatorname {cov} (\mathbf {X} ,\mathbf {Y} )=\operatorname {cov} (\mathbf {Y} ,\mathbf {X} )^{\top }}
cov
(
X
1
+
X
2
,
Y
)
=
cov
(
X
1
,
Y
)
+
cov
(
X
2
,
Y
)
{\displaystyle \operatorname {cov} (\mathbf {X} _{1}+\mathbf {X} _{2},\mathbf {Y} )=\operatorname {cov} (\mathbf {X} _{1},\mathbf {Y} )+\operatorname {cov} (\mathbf {X} _{2},\mathbf {Y} )}
kadar velja p = q , potem je
var
(
X
+
Y
)
=
var
(
X
)
+
cov
(
X
,
Y
)
+
cov
(
Y
,
X
)
+
var
(
Y
)
{\displaystyle \operatorname {var} (\mathbf {X} +\mathbf {Y} )=\operatorname {var} (\mathbf {X} )+\operatorname {cov} (\mathbf {X} ,\mathbf {Y} )+\operatorname {cov} (\mathbf {Y} ,\mathbf {X} )+\operatorname {var} (\mathbf {Y} )}
cov
(
A
X
,
B
⊤
Y
)
=
A
cov
(
X
,
Y
)
B
{\displaystyle \operatorname {cov} (\mathbf {AX} ,\mathbf {B} ^{\top }\mathbf {Y} )=\mathbf {A} \,\operatorname {cov} (\mathbf {X} ,\mathbf {Y} )\,\mathbf {B} }
kadar sta
X
{\displaystyle \mathbf {X} }
in
Y
{\displaystyle \mathbf {Y} }
neodvisna, velja tudi
cov
(
X
Y
)
=
0
{\displaystyle \operatorname {cov} (\mathbf {X} \mathbf {Y} )=0\,}
.