Salta al contenuto
Note per Studenti Mean Vector and Covariance Matrix Report

Mean Vector and Covariance Matrix

In questa pagina 6

Basic parameters of random vectors

In what follows random vectors are column vectors in Rn\mathbb{R}^n, written

X‾=(X1X2⋮Xn),\underline X=\begin{pmatrix}X_1\\X_2\\ \vdots\\X_n\end{pmatrix},

probabilistically characterized by a discrete density pX1X2…Xnp_{X_1X_2\dots X_n} or by a density function fX1X2…Xnf_{X_1X_2\dots X_n} (see Discrete Random VectorsA discrete random vector (X,Y) is described by its joint discrete density p_XY(x_i,y_j) = P(X = x_i, Y = y_j), whose marginals are obtained by summing over the other variable and which gives expectations of any function g(X,Y), including E(XY), covariance and the density of X + Y.Discrete Random Vectors → and Absolutely Continuous Random VectorsAn absolutely continuous random vector (X,Y) has a joint density f_XY with F_XY the double integral of f_XY; probabilities of sets are double integrals, marginals are obtained by integrating out one variable, the uniform vector on D has density 1/area(D) on D, and the density of X + Y is an integral of f_XY along the line x + y = z.Absolutely Continuous Random Vectors →).

Definition (mean vector). μ‾X≜E(X‾)≜(E(X1)⋮E(Xn))∈Rn.\underline\mu_X\triangleq E(\underline X)\triangleq\begin{pmatrix}E(X_1)\\ \vdots\\E(X_n)\end{pmatrix}\in\mathbb{R}^n.

Its components are the expected values of the random variables X1,…,XnX_1,\dots,X_n.

Remark. To compute μ‾X\underline\mu_X it is enough to know the marginals pXip_{X_i} or fXif_{X_i} for i=1,…,ni=1,\dots,n; it is not necessary to know the joint density of the random vector.

Correlation matrix

Definition (correlation matrix). RX‾≜corr(X‾)≜E(X‾ X‾T)=E[(X1⋮Xn)(X1 ⋯ Xn)]=E(X12X1X2⋯X1XnX2X1X22⋯X2Xn⋮⋮XnX1XnX2⋯Xn2)R_{\underline X}\triangleq\mathrm{corr}(\underline X)\triangleq E(\underline X\,\underline X^T)=E\left[\begin{pmatrix}X_1\\ \vdots\\X_n\end{pmatrix}(X_1\ \cdots\ X_n)\right]=E\begin{pmatrix}X_1^2&X_1X_2&\cdots&X_1X_n\\X_2X_1&X_2^2&\cdots&X_2X_n\\ \vdots&&&\vdots\\X_nX_1&X_nX_2&\cdots&X_n^2\end{pmatrix}

so the (i,j)(i,j) entry is E(XiXj)E(X_iX_j), with E(Xi2)E(X_i^2) on the diagonal.

Remark. To compute RX‾R_{\underline X} it is enough to know all the marginals for pairs of the random variables X1,…,XnX_1,\dots,X_n.

Properties.

  1. RX‾=RX‾TR_{\underline X}=R_{\underline X}^T (symmetric).
  2. RX‾≥0R_{\underline X}\ge0 (in the sense of positive definite matrices; what is proved is a‾TRX‾a‾≥0\underline a^TR_{\underline X}\underline a\ge0 for all a‾\underline a, i.e. positive semidefinite).

Proof. 1 is trivial from the definition. For 2 one needs a‾TRX‾a‾≥0\underline a^TR_{\underline X}\underline a\ge0 for all a‾∈Rn\underline a\in\mathbb{R}^n:

a‾TRX‾a‾=a‾TE(X‾X‾T)a‾=E(a‾TX‾ X‾Ta‾).\underline a^TR_{\underline X}\underline a=\underline a^TE(\underline X\underline X^T)\underline a=E(\underline a^T\underline X\,\underline X^T\underline a).

Letting Z≜a‾TX‾=(a1,…,an)(X1⋮Xn)=∑i=1naiXi∈RZ\triangleq\underline a^T\underline X=(a_1,\dots,a_n)\begin{pmatrix}X_1\\ \vdots\\X_n\end{pmatrix}=\sum_{i=1}^na_iX_i\in\mathbb{R} (a scalar random variable), a‾TX‾ X‾Ta‾=Z2\underline a^T\underline X\,\underline X^T\underline a=Z^2 and so a‾TRX‾a‾=E(Z2)≥0\underline a^TR_{\underline X}\underline a=E(Z^2)\ge0 since Z2≥0Z^2\ge0 always. □\square

Variance (covariance) matrix

Definition (variance matrix, or variance/covariance matrix). ΣX‾≜cov(X‾)≜E((X‾−μ‾X)(X‾−μ‾X)T)=E((X1−μ1)2(X1−μ1)(X2−μ2)⋯⋮⋮⋯(Xn−μn)2)=(var(X1)cov(X1,X2)⋯cov(X1,Xn)⋮⋮cov(X1,Xn)⋯var(Xn)).\Sigma_{\underline X}\triangleq\mathrm{cov}(\underline X)\triangleq E\big((\underline X-\underline\mu_X)(\underline X-\underline\mu_X)^T\big)=E\begin{pmatrix}(X_1-\mu_1)^2&(X_1-\mu_1)(X_2-\mu_2)&\cdots\\ \vdots&&\vdots\\ \cdots&&(X_n-\mu_n)^2\end{pmatrix}=\begin{pmatrix}\mathrm{var}(X_1)&\mathrm{cov}(X_1,X_2)&\cdots&\mathrm{cov}(X_1,X_n)\\ \vdots&&&\vdots\\ \mathrm{cov}(X_1,X_n)&\cdots&&\mathrm{var}(X_n)\end{pmatrix}.

Remarks.

  1. To compute ΣX‾\Sigma_{\underline X} it is enough to know fXiXj(xi,xj)f_{X_iX_j}(x_i,x_j) for all i,j=1,…,ni,j=1,\dots,n.
  2. ΣX‾\Sigma_{\underline X} is symmetric (trivial).
  3. For any a‾∈Rn\underline a\in\mathbb{R}^n: a‾TΣX‾a‾=a‾TE((X‾−μ‾X)(X‾−μ‾X)T)a‾=E(a‾T(X‾−μ‾X)(X‾−μ‾X)Ta‾)=E(Z2)≥0\underline a^T\Sigma_{\underline X}\underline a=\underline a^TE\big((\underline X-\underline\mu_X)(\underline X-\underline\mu_X)^T\big)\underline a=E\big(\underline a^T(\underline X-\underline\mu_X)(\underline X-\underline\mu_X)^T\underline a\big)=E(Z^2)\ge0, where Z=a‾T(X‾−μ‾X)∈RZ=\underline a^T(\underline X-\underline\mu_X)\in\mathbb{R}. The conclusion is that ΣX‾≥0\Sigma_{\underline X}\ge0 in the sense of positive definite matrices (positive semidefinite).
  4. If the components of X‾\underline X are uncorrelated, i.e. cov(Xi,Xj)=0\mathrm{cov}(X_i,X_j)=0 for all i≠ji\ne j (see Covariance and CorrelationThe variance of a sum X + Y equals var(X) + var(Y) + 2 cov(X,Y), where the covariance E((X - E(X))(Y - E(Y))) cannot be computed from the two marginal laws alone, which motivates the study of random vectors and joint behaviour.Covariance and Correlation →), then ΣX‾\Sigma_{\underline X} is a diagonal matrix.
  5. ΣX‾=RX‾−μ‾Xμ‾XT\Sigma_{\underline X}=R_{\underline X}-\underline\mu_X\underline\mu_X^T.

Proof of 5. ΣX‾=E(X‾−μ‾X)(X‾−μ‾X)T=E(X‾X‾T)−μ‾XE(X‾T)−E(X‾)μ‾XT+μ‾Xμ‾XT=RX‾−μ‾Xμ‾XT−μ‾Xμ‾XT+μ‾Xμ‾XT=RX‾−μ‾Xμ‾XT. □\Sigma_{\underline X}=E(\underline X-\underline\mu_X)(\underline X-\underline\mu_X)^T=E(\underline X\underline X^T)-\underline\mu_XE(\underline X^T)-E(\underline X)\underline\mu_X^T+\underline\mu_X\underline\mu_X^T=R_{\underline X}-\underline\mu_X\underline\mu_X^T-\underline\mu_X\underline\mu_X^T+\underline\mu_X\underline\mu_X^T=R_{\underline X}-\underline\mu_X\underline\mu_X^T.\ \square

Cross-correlation matrix

Definition (cross-correlation matrix). Given two random vectors X‾∈Rn\underline X\in\mathbb{R}^n and Y‾∈Rm\underline Y\in\mathbb{R}^m (warning: X‾∈Rn\underline X\in\mathbb{R}^n is an abuse of notation, because a random vector is not a vector of real numbers but a vector of functions; it is only used to point out the dimensionality), the cross-correlation matrix is

RX‾Y‾=E(X‾ Y‾T)∈Rn×m=(E(X1Y1)E(X1Y2)⋯E(X1Ym)⋮⋮E(XnY1)⋯E(XnYm))R_{\underline X\underline Y}=E(\underline X\,\underline Y^T)\in\mathbb{R}^{n\times m}=\begin{pmatrix}E(X_1Y_1)&E(X_1Y_2)&\cdots&E(X_1Y_m)\\ \vdots&&&\vdots\\E(X_nY_1)&&\cdots&E(X_nY_m)\end{pmatrix}

(there is no abuse of notation in the statement RX‾Y‾∈Rn×mR_{\underline X\underline Y}\in\mathbb{R}^{n\times m}).

Remarks.

  1. To compute RX‾Y‾R_{\underline X\underline Y} it is enough to know fXiYj(xi,yj)f_{X_iY_j}(x_i,y_j) for all i=1,…,ni=1,\dots,n, j=1,…,mj=1,\dots,m.
  2. RX‾Y‾T=RY‾X‾R_{\underline X\underline Y}^T=R_{\underline Y\underline X}.

Affine transformations

Lemma. Let Y‾=AX‾+b‾\underline Y=A\underline X+\underline b, with X‾\underline X a random vector in Rn\mathbb{R}^n, A∈Rm×nA\in\mathbb{R}^{m\times n}, b‾∈Rm\underline b\in\mathbb{R}^m and Y‾\underline Y a random vector in Rm\mathbb{R}^m. Then

μ‾Y=E(Y‾)=E(AX‾+b‾)=Aμ‾X+b‾,ΣY‾=AΣX‾AT,RY‾=ΣY‾+μ‾Yμ‾YT.\underline\mu_Y=E(\underline Y)=E(A\underline X+\underline b)=A\underline\mu_X+\underline b,\qquad\Sigma_{\underline Y}=A\Sigma_{\underline X}A^T,\qquad R_{\underline Y}=\Sigma_{\underline Y}+\underline\mu_Y\underline\mu_Y^T.

Proof. μ‾Y=E(AX‾+b‾)=Aμ‾X+b‾\underline\mu_Y=E(A\underline X+\underline b)=A\underline\mu_X+\underline b. For the covariance, the constant b‾\underline b cancels: ΣY‾=E((Y‾−μ‾Y)(Y‾−μ‾Y)T)=E((AX‾+b‾−Aμ‾X−b‾)(… )T)=E(A(X‾−μ‾X)(X‾−μ‾X)TAT)=AΣX‾AT.\Sigma_{\underline Y}=E\big((\underline Y-\underline\mu_Y)(\underline Y-\underline\mu_Y)^T\big)=E\big((A\underline X+\underline b-A\underline\mu_X-\underline b)(\dots)^T\big)=E\big(A(\underline X-\underline\mu_X)(\underline X-\underline\mu_X)^TA^T\big)=A\Sigma_{\underline X}A^T. The last relation RY‾=ΣY‾+μ‾Yμ‾YTR_{\underline Y}=\Sigma_{\underline Y}+\underline\mu_Y\underline\mu_Y^T was already proved (property 5). □\square

Singular covariance matrix

Lemma. Let V‾=(XY)\underline V=\begin{pmatrix}X\\Y\end{pmatrix}. If ΣV‾\Sigma_{\underline V} is singular, i.e. det⁡(ΣV‾)=0\det(\Sigma_{\underline V})=0, then there exists a vector (αβ)∈R2\begin{pmatrix}\alpha\\\beta\end{pmatrix}\in\mathbb{R}^2 such that (α,β)(XY)=αX+βY(\alpha,\beta)\begin{pmatrix}X\\Y\end{pmatrix}=\alpha X+\beta Y is a degenerate (constant) random variable.

Proof. ΣV‾\Sigma_{\underline V} singular ⇒\Rightarrow there exists a‾=(αβ)≠(00)\underline a=\begin{pmatrix}\alpha\\\beta\end{pmatrix}\ne\begin{pmatrix}0\\0\end{pmatrix} such that ΣV‾a‾=(00)\Sigma_{\underline V}\underline a=\begin{pmatrix}0\\0\end{pmatrix}. Therefore

0=a‾TΣV‾a‾=(α β)(var(X)cov(X,Y)cov(X,Y)var(Y))(αβ)=α2var(X)+2αβ cov(X,Y)+β2var(Y)0=\underline a^T\Sigma_{\underline V}\underline a=(\alpha\ \beta)\begin{pmatrix}\mathrm{var}(X)&\mathrm{cov}(X,Y)\\\mathrm{cov}(X,Y)&\mathrm{var}(Y)\end{pmatrix}\begin{pmatrix}\alpha\\\beta\end{pmatrix}=\alpha^2\mathrm{var}(X)+2\alpha\beta\,\mathrm{cov}(X,Y)+\beta^2\mathrm{var}(Y) =E(α2(X−μX)2+2αβ(X−μX)(Y−μY)+β2(Y−μY)2)=E((α(X−μX)+β(Y−μY))2),=E\big(\alpha^2(X-\mu_X)^2+2\alpha\beta(X-\mu_X)(Y-\mu_Y)+\beta^2(Y-\mu_Y)^2\big)=E\Big(\big(\alpha(X-\mu_X)+\beta(Y-\mu_Y)\big)^2\Big),

a nonnegative variable with zero mean, so α(X−μX)+β(Y−μY)=0\alpha(X-\mu_X)+\beta(Y-\mu_Y)=0, i.e.

αX+βY=αμX+βμY=c(constant, degenerate random variable). □\alpha X+\beta Y=\alpha\mu_X+\beta\mu_Y=c\quad(\text{constant, degenerate random variable}).\ \square

Corollary. V‾=(XY)\underline V=\begin{pmatrix}X\\Y\end{pmatrix} cannot be absolutely continuous if det⁡ΣV‾=0\det\Sigma_{\underline V}=0. (Reason, combining the lemma with the remark that a curve has probability zero under a joint density: (X,Y)(X,Y) would lie on the line αx+βy=c\alpha x+\beta y=c, which has probability 11 and area 00.)

Versione ripasso

Column random vectors X‾=(X1,…,Xn)T\underline X=(X_1,\dots,X_n)^T.

Mean vector. μ‾X=E(X‾)=(E(X1),…,E(Xn))T\underline\mu_X=E(\underline X)=(E(X_1),\dots,E(X_n))^T; only marginals needed.

Correlation matrix. RX‾=E(X‾X‾T)R_{\underline X}=E(\underline X\underline X^T), entries E(XiXj)E(X_iX_j). Symmetric, positive semidefinite: a‾TRa‾=E(Z2)≥0\underline a^TR\underline a=E(Z^2)\ge0 with Z=a‾TX‾Z=\underline a^T\underline X. Needs only pairwise marginals.

Covariance matrix. ΣX‾=E((X‾−μ‾X)(X‾−μ‾X)T)\Sigma_{\underline X}=E\big((\underline X-\underline\mu_X)(\underline X-\underline\mu_X)^T\big), entries cov(Xi,Xj)\mathrm{cov}(X_i,X_j), variances on the diagonal.

  • symmetric, a‾TΣa‾=E(Z2)≥0\underline a^T\Sigma\underline a=E(Z^2)\ge0 with Z=a‾T(X‾−μ‾X)Z=\underline a^T(\underline X-\underline\mu_X);
  • uncorrelated components ⇔\Leftrightarrow Σ\Sigma diagonal;
  • ΣX‾=RX‾−μ‾Xμ‾XT\Sigma_{\underline X}=R_{\underline X}-\underline\mu_X\underline\mu_X^T (expand the product).

Cross-correlation. RX‾Y‾=E(X‾Y‾T)∈Rn×mR_{\underline X\underline Y}=E(\underline X\underline Y^T)\in\mathbb{R}^{n\times m}, RX‾Y‾T=RY‾X‾R_{\underline X\underline Y}^T=R_{\underline Y\underline X}.

Affine map Y‾=AX‾+b‾\underline Y=A\underline X+\underline b: μ‾Y=Aμ‾X+b‾,ΣY=AΣXAT,RY=ΣY+μ‾Yμ‾YT.\underline\mu_Y=A\underline\mu_X+\underline b,\qquad\Sigma_Y=A\Sigma_XA^T,\qquad R_Y=\Sigma_Y+\underline\mu_Y\underline\mu_Y^T.

Singular Σ\Sigma. det⁡Σ(X,Y)=0⇒∃(α,β)≠0\det\Sigma_{(X,Y)}=0\Rightarrow\exists(\alpha,\beta)\neq0 with αX+βY\alpha X+\beta Y constant (from 0=a‾TΣa‾=E((α(X−μX)+β(Y−μY))2)0=\underline a^T\Sigma\underline a=E((\alpha(X-\mu_X)+\beta(Y-\mu_Y))^2)); hence (X,Y)(X,Y) cannot be absolutely continuous.

Typical mistakes. Writing ΣY=AΣXA\Sigma_Y=A\Sigma_XA (the second factor is ATA^T); adding b‾\underline b to the covariance; confusing RR and Σ\Sigma (they differ by μ‾μ‾T\underline\mu\underline\mu^T); dimension errors (AΣATA\Sigma A^T is m×mm\times m).

Teoria collegata