Hello all,

I wish to compute site scores using PCA (prcomp) on a matrix with missing values, for example:

   Drain    Slope    OrgL
a    4    1    NA
b    2.5    39    6
c    6    8    45
d    3    9    12
e    3    16    4
...

Where a,b... are sites.
The command
> pca<-prcomp(~ Drain + Slope + OrgL, data = t, center = TRUE, scale = TRUE, na.action=na.exclude)
works great, and from
> pca$x
I can get site scores, e.g.

                      PC1          PC2          PC3
a          NA           NA           NA
b -2.10475208 -2.315128625 -0.885197753
c  5.01177388 -1.778786252 -0.193285051
d  0.28638602  0.298315086  0.386113799
e -0.58861254  0.089498632 -0.434951813
...

Easy enough...
But how do I use the "napredict" argument? Is it intended as an argument to be used in the prcomp line (as suggested in ?prcomp), or is it to be used by itself, to replace NAs in the above site score matrix (which is what I really want to do).

Thank you,
Alain

--
Alain Paquette, Ph.D.
alain.paque...@gmail.com

Centre d'étude de la forêt (CEF)
Université du Québec à Montréal
www.cef-cfr.ca

Projet TRIADE
www.projettriade.ca
alain.paque...@projettriade.ca

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to