Thread Subject: PCA, princomp : COEFF == correlation matrix?

Subject: PCA, princomp : COEFF == correlation matrix?

From: Stéphane

Date: 10 May, 2011 20:23:05

Message: 1 of 3

Hello,

I am wondering if the n x n matrix returned by princomp ([COEFF,SCORE,eigenval,tsquare] = princomp(X) ) is the covariance matrix C=X'X ? Or is C containing the eigenvectors? Or both ( are they the same? I read that you have to diagonalize C to get the eigenvectors, but I am not sure anymore).

Thank you!!

Stephane

Subject: PCA, princomp : COEFF == correlation matrix?

From: Adrien Leygue

Date: 10 May, 2011 21:25:20

Message: 2 of 3

Ok, some pieces of advice:

1-Before you use a numerical tool be sure you understand at least the basic behind the method (here the basic math and statistics). You do not need to be an expert in every single detail but just enough to be an enlightened user. Otherwise you run the risk of GIGO : "garbage in garbage out".

2-Read the manual: http://www.mathworks.com/help/toolbox/stats/princomp.html
I quote:

"COEFF = princomp(X) performs principal components analysis on the n-by-p data matrix X, and returns the principal component coefficients, also known as loadings. Rows of X correspond to observations, columns to variables. COEFF is a p-by-p matrix, each column containing coefficients for one principal component. The columns are in order of decreasing component variance."

This tells you all you need.

3-The great thing with Matlab is that you have so many built-in tools that it is easy to test things on a simple case to solve your problems. Here, I'd suggest looking at the eig function to compare things with the output of princomp.

Subject: PCA, princomp : COEFF == correlation matrix?

From: Stéphane

Date: 10 May, 2011 23:34:04

Message: 3 of 3

OK, first, thanks for the answer;

I think I DO understand the basics behind the PCA; the purpose of my post was to answer this simple question : are the coeffs the covariance matrix eigenvectors, or the covariance matrix itself? Both have p x p size.

I'll try eig anyway, as you suggested.

thx

"Adrien Leygue" wrote in message <iqcag0$ah1$1@newscl01ah.mathworks.com>...
> Ok, some pieces of advice:
>
> 1-Before you use a numerical tool be sure you understand at least the basic behind the method (here the basic math and statistics). You do not need to be an expert in every single detail but just enough to be an enlightened user. Otherwise you run the risk of GIGO : "garbage in garbage out".
>
> 2-Read the manual: http://www.mathworks.com/help/toolbox/stats/princomp.html
> I quote:
>
> "COEFF = princomp(X) performs principal components analysis on the n-by-p data matrix X, and returns the principal component coefficients, also known as loadings. Rows of X correspond to observations, columns to variables. COEFF is a p-by-p matrix, each column containing coefficients for one principal component. The columns are in order of decreasing component variance."
>
> This tells you all you need.
>
> 3-The great thing with Matlab is that you have so many built-in tools that it is easy to test things on a simple case to solve your problems. Here, I'd suggest looking at the eig function to compare things with the output of princomp.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
pca Stéphane 10 May, 2011 16:24:06
princomp Stéphane 10 May, 2011 16:24:06
eigenvectors Stéphane 10 May, 2011 16:24:06
rssFeed for this Thread

Contact us at files@mathworks.com