[R] environmental data as vector in PCA plots
Jari Oksanen
jari.oksanen at oulu.fi
Mon May 10 18:09:16 CEST 2004
On 10 May 2004, at 17:15, Heike Schmitt wrote:
> I want to include a vector representing the sites - environmental data
> correlation in a PCA.
> I currently use prcomp (no scaling) to perform the PCA, and envfit to
> retrieve the coordinates of the environmental data vector. However, the
> vector length is different from the one obtained in CAnoco when
> performing
> a species - environmental biplot (scaling -2). How can I scale the
> vector
> in order to be in accordance with Canoco, or which other scaling
> options
> are there?
Canoco scaling abs(2) does not scale sites, but the sum of squares of
site scores = 1 for all axes. In contrast, prcomp scales site axes by
eigenvalue, like does Canoco with scaling abs(1). Therefore you cannot
get similar results as in Canoco. A simple solution that *may* (or may
not) work is to transpose your data: instead of prcomp(x), try
prcomp(t(scale(x, scale=F), center=F). This does the centring to the
columns of x (like it should be done), then transposes your data and
prcomp's without new centring -- which was already made for columns (I
didn't test this, but this way it was done in the olden times). Another
alternative is to use the function rda in the same package where you
found envfit (vegan), since it is not unlike Canoco in its scaling.
However, it won't give you negative scalings of PCA (RDA without
constraints), since its author (that's I) thinks that you shouldn't use
negative scaling of Canoco in RDA/PCA. The package ships with a pdf
document which discusses PCA scaling in prcomp, princomp, rda (of
vegan) and Canoco (of Cajo ter Braak), and even hints how to get the
minus scalings that the author doesn't approve.
cheers, jari oksanen
--
Jari Oksanen, Oulu, Finland
More information about the R-help
mailing list