1

This article Mean Vector and Covariance Matrix explains the calculation of Covariance Matrix for this input data:
\begin{equation*} X = \begin{bmatrix} 4.0 & 2.0 & 0.60 \\ 4.2 & 2.1 & 0.59 \\ 3.9 & 2.0 & 0.58 \\ 4.3 & 2.1 & 0.62 \\ 4.1 & 2.2 & 0.63 \end{bmatrix} \end{equation*} where each row is an observation of three variables(three columns).
The mean vector is:
\begin{equation*} \bar X = \begin{bmatrix} 4.10 & 2.08 & 0.604 \end{bmatrix} \end{equation*} and the formula for covariance matrix is(n=5):
\begin{equation*} S = {1 \over n-1} \sum_{i=1}^n(X_i - \bar X)(X_i - \bar X)^T \end{equation*}

But the dimension seems not right:
Both $X_i$ and $\bar X$ is of shape(1,3), so $(X_i - \bar X)$ would be of shape (1,3) and $(X_i - \bar X)^T$ would be (3,1), S would be (1,1).

Shouldn't the equation be
\begin{equation*} S = {1 \over n-1} \sum_{i=1}^n(X_i - \bar X)^T(X_i - \bar X) \end{equation*} and get S of shape (3,3)?

hello.wjx
  • 111

0 Answers0