Timeline for PCR after PCA with mixed data - how to extract/export the PCs as new variables in R?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 17, 2020 at 12:17 | comment | added | daedhalus | OK, I will try to find out how to manually scale the data, but I thiiiink the FAMD() of the FactoMineR package actually does that automatically, see: "FAMD is a principal component method dedicated to explore data with both continuous and categorical variables. It can be seen roughly as a mixed between PCA and MCA. More precisely, the continuous variables are scaled to unit variance and the categorical variables are transformed into a disjunctive data table (crisp coding) and then scaled using the specific scaling of MCA." | |
Apr 16, 2020 at 13:24 | comment | added | StupidWolf |
ok make sure you scale the data, and just use res.pca$ind$coord , you want to do your pc regression, and i think you can proceed with that. by results i mean the fitted values from the regression
|
|
Apr 16, 2020 at 13:23 | comment | added | daedhalus | that's strange, when I use svd§U I get different values then with ind§coord. Why is this so complicated. | |
Apr 16, 2020 at 13:21 | history | edited | StupidWolf | CC BY-SA 4.0 |
added 366 characters in body
|
Apr 16, 2020 at 13:15 | comment | added | StupidWolf |
and you can see that if you use res.pca$svd$U or res.pca$ind$coord , the results are the same
|
|
Apr 16, 2020 at 13:08 | comment | added | StupidWolf | you can take the values from res.pca$ind$coord. I edit my answer to explain how it is derived.. sorry I did not realize they give you the values back | |
Apr 16, 2020 at 12:52 | comment | added | daedhalus | Browsing the factoMineR FAQ side there is an entry which says: "Where do I find scores [and loadings] in res.pca? -> Scores (i.e. principal coordinates) are in: res.pca$ind$coord The variance of the individuals' coordinates for a dimension corresponds to the eigenvalue of this dimension." Now I am just more confused about whether the scores are in scd§U or in ind§coord? | |
Apr 16, 2020 at 12:03 | comment | added | daedhalus | When I run res.pcamix$ind$coord for the pcamixdata package I get the same values as in running pca.res$ind$coord with FactoMineR. I suppose the values should however be identical to the output of pca.res$svd$U? | |
Apr 16, 2020 at 10:48 | comment | added | StupidWolf | quickly looking at the package vignette it should be res.pcamix$ind$coord, cos it says ‘$coord’: factor coordinates (scores) of the individuals, again, i am not familiar with this so you should double check it | |
Apr 16, 2020 at 10:44 | comment | added | StupidWolf | yes you look for the scores / components basically, to fit a new regression. I am not familiar with PCAmixdata, I think you need to find where this matrix is stored. Not so familiar with that package unfortunately | |
Apr 16, 2020 at 10:34 | comment | added | daedhalus | Thank you SO much for the quick reply! This is extremely helpful, I could almost cry. Do I understand it correctly then that the principle component scores are - independent from what type of function I use - the scores I always have to look for and use when fitting the PCs as new variables in a subsequent regression? Do you know by any chance where the scores are stored when applying the PCAmixdata package? And if I may ask one last question concerning you comment on the pcr() function: Is it possible to use the function on mixed data in that case?? | |
Apr 16, 2020 at 10:20 | vote | accept | daedhalus | ||
Apr 16, 2020 at 9:46 | history | answered | StupidWolf | CC BY-SA 4.0 |