Processing math: 100%

 

 

 

Rewriting the Covariance and/or Correlation Matrix

We can rewrite the covariance matrix in a more compact form in terms of the design/feature matrix X as

C[x]=1nXTX=E[XTX].

To see this let us simply look at a design matrix XR2×2

X=[x00x01x10x11]=[x0x1].

If we then compute the expectation value (note the 1/n factor instead of 1/(n1))

E[XTX]=1nXTX=1n[x200+x210x00x01+x10x11x01x00+x11x10x201+x211],

which is just

C[x0,x1]=C[x]=[var[x0]cov[x0,x1]cov[x1,x0]var[x1]],

where we wrote C[x0,x1]=C[x] to indicate that this is the covariance of the vectors x of the design/feature matrix X.

It is easy to generalize this to a matrix XRn×p.