PCA matrix indexed by Day

2 views (last 30 days)
SergeK
SergeK on 29 Apr 2011
Hi,
I have successfully run a PCA on one 17x40 matrix using princomp matlab function. But each matrix is indexed by day. Now I would like to get the PCA from 30 days,60 and 90 days (example : 30 days of 17x40 matrix). Do you know the best way to do it?
Thank you for your help.

Answers (1)

Matt Tearle
Matt Tearle on 29 Apr 2011
How are the matrices stored? Chances are, this is probably time for an old-fashioned for-loop, possibly using 3-D arrays.
  2 Comments
SergeK
SergeK on 29 Apr 2011
Hi, thank you for your quick reply.
I have one matrix per day.
In the case of a for loop I would get one PCA per day.
I want to extract only one PCA for the whole 30 days and as far as I know princomp is accepting only n x p matrix.
Matt Tearle
Matt Tearle on 3 May 2011
Right, PCA is a method for transforming p-dimensional space, in which the n observations live. So it's inherently a matrix operation. So the real question is how are you trying to interpret what you want to do? Do you want each of the 30 days to be an observation? It sounds that way, but then what are the 17 rows that you currently have? Perhaps you need to reshape your data into 17*30 rows and 40 columns. Or perhaps you need to do some kind of averaging or other aggregation. It's hard to say without knowing the point of what you're doing or what you're hoping to get out of it at the end.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!