PCA Matrix Shapes

203 Views Asked by At

This is a simple, kind of, yes no question. I am trying to understand PCA, and I am going through the wikipedia article on PCA. Something is throwing me off. I am going through the details section. Throughout this section we assume that we are using a matrix of data, called X:

Consider a data matrix, X, with zero empirical mean (the empirical (sample) mean of the distribution has been subtracted from the data set), where each of the n rows represents a different repetition of the experiment, and each of the p columns gives a particular kind of datum (say, the results from a particular probe).

A little farther down it explains how we get the principle components decomposition of X as:

T=XW

quote from wikipedia article:

where W is a p-by-p matrix whose columns are the eigenvectors of XTX

My question is: is this a mistake?

X is an n x p matrix, so it would be impossible to do matrix multiplication if W is a p x p matrix. W would have to be p x n.

Am I right, or is W always p x p and I am still not getting something? Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

a n x p matrix multiplied to a p x q matrix is a n x q matrix. n x p * p x p gives a n x p matrix.

0
On

$X$ is $n \times p$ and $W$ is $p \times p$, so the multiplication $XW$ is fine.