Group Abstract Group Abstract

Message Boards Message Boards

Calculate component loadings from Principal Components?

Posted 10 years ago

Hi, So I have a set of data that I want to run PCA on. In SPSS this is very simple, and it spits out a clean component matrix. My question is how does one take the output of PrincipalComponents[data,Method->"Correlation"] and get the component matrix?

6 Replies

I do believe it works! Thank you Jim Baldwin. Sorry for the delay in confirmation. I was running something that took a long time on all of my kernels

Posted 10 years ago

Good. I assume you must have access to SPSS and I also assume you'll be trying the same dataset on both SPSS and Mathematica as there are many times subtle but definite differences in algorithms, settings, assumptions, jargon, etc.

POSTED BY: Jim Baldwin
Posted 10 years ago
POSTED BY: Jim Baldwin

so just to make sure I understand, -0.60157 is the component loading of the first variable for the 1st principal component?

Posted 10 years ago

It's pretty simple, too, in Mathematica. Here's one way:

data = {{13.2, 200, 58, 21.2}, {10, 263, 48, 44.5}, {8.1, 294, 80, 31}, {8.8, 190, 50, 19.5}, {9, 276, 91, 40.6},
   {7.9, 204, 78, 38.7}, {3.3, 110, 77, 11.1}, {5.9, 238, 72, 15.8}, {15.4, 335, 80, 31.9}, {17.4, 211, 60, 25.8}};
pc = PrincipalComponents[data, Method -> "Correlation"];
k = Dimensions[data][[2]];
Table[Correlation[pc[[All, i]], data[[All, j]]], {i, k}, {j, k}] // MatrixForm

Correlations

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard