I’m doing some PCA analysis for my data. and its my first time to try this type of analysis.
I’m having a matrix of a thousand columns and few thousands of rows, and i am trying to make a smaller matrix by getting rid of correlated variables (which are the columns in my case).
everything is going great until the moment, but i am unable to do the next step.
here’s an example to show my data.
a1 a2 a3 a4 .... a1000
item1 10 NA 5 3 ....
item2 0.01 0.5 NA 0.07 ....
item3 0.7 0.2 0.8 0.9 ....
.
.
.
I apply the princomp and get the following results
Comp.1 Comp.2 Comp.3 Comp.4 ... Comp.1000
Standard deviation 24.1605431 7.31176669 5.96709553 3.56507807 ...
Proportion of Variance 0.7580933 0.06943108 0.04624186 0.01650621 ...
Cumulative Proportion 0.7580933 0.82752438 0.87376624 0.89027245 ...
.
.
.
Now that i have computed everything…my question is: what command should i use to pick the uncorrelated components and paste them into a new matrix (or simply get rid of the correlated ones)?
how do i specify the range of correlation i want?
Thanks,
I believe you are after the
scores. From the help for?princomp, the resulting object is a list that contains an elementsscores:Let’s set up an example (based on example in
?princomp):You can investigate the result object with
str():Now extract the scores: