# Sample covariance matrix


Let $\X$ denote an $N\times T$ matrix of $T$ observations on a system of $N$ random variables representing $T$ returns on a universe of $N$ stocks. Then the sample covariance matrix is defined (p.\ 606) as:

$$\S= \frac{1}{T}\X\left( \I - \frac{1}{T} \1\1' \right) \X'$$

I find difficult to understand the above estimator. I would normally use something like:

$$\frac{1}{T-1} \left(\frac{1}{T}\X\I - \X\right) \left(\frac{1}{T}\X\I - \X\right)'$$

-

I believe there is a confusion of notation here. The paper uses $\I$ to denote the identity matrix, while you seem to use this symbol to denote a matrix where all its elements are equal to one, which the paper expresses using the notation $\1\1'$, $\1$ denoting a column vector of ones. (Moreover the paper defines $\X$ as a matrix where the series of a regressor is in one row, not in one column as is the most traditional case, but you don't seem troubled by this).

If we get past this notational issue, then the two expressions are the same (taking into account that you use $\I$ to denote $\1\1'$), since the matrix (using the paper's notation) $$Q_T = \I - \frac{1}{T} \1\1'$$ is idempotent and symmetric, with the only remaining difference being that you apply bias correction by dividing by $(T-1)$ while the paper doesn't.

If you too, write $\I$ for the identity matrix, then your expression is simply mistaken, since it does not lead to subtraction of the sample mean from the observations.

-

The simplest way to understand the equation for S is by rearranging it as follows, using the expression for means vector $m=\frac{1}{T}X1$ given in the same paper:

$S=\frac{1}{T}\left(XX'-T\left(\frac{1}{T}X1\right)\left(1'X'\frac{1}{T}\right)\right)=\frac{1}{T}XX'-mm'$.

It should be obvious now how the equation for S corresponds to a usual covariance formula $E[xy]-E[x]E[y]$

The confusion is in somewhat unusual notation $1$ for conformant vector of ones: a $T\times 1$ vector of all 1s. So, the mean vector $m$ is simply a mean of each variable $m_i=\frac{\sum_{t=1}^T X_{it}\times 1}{T}$, i.e. a product of $N\times T$ matrix and $T\times 1$ vector is $N\times 1$ vector. Note, that $X1$ is the sum of each variable.

Now, $11'$ is the product of $T\times 1$ and $1\times T$ vectors, it's a $T\times T$ matrix of all 1s.

$I$ is a usual $T\times T$ identity matrix.

-