Skip to content
Prev 4694 / 7420 Next

scaling issues with vegan's envfit()

If I understand correctly Arnaud, you just need `predict()`:

predict(pca1, newdata = varechem, type = "sp", scaling = 1)[, 1:2]

where you set newdata to be the data frame of new variables you want to
add. This will add so-called passive species to the plot base on the linear
combinations of the site scores produced from the ordination of the
original data. Hence the new data need to be measured on the same sites and
have the same row names as the data used to fit the PCA (as that is how
vegan identifies them).

Using the example you gave I get:
PC1        PC2
N         0.4008477  0.5267927
P        -1.5075888 -0.8781843
K        -1.5384951 -0.6850869
Ca       -1.5239497 -0.3582552
Mg       -1.4922949 -0.4141239
S        -1.4083631 -1.2567985
Al        0.4893605 -2.0353607
Fe        0.8599106 -1.6224771
Mn       -1.2181461  0.8183585
Zn       -1.4658174 -0.6861639
Mo       -0.1759892 -0.9685048
Baresoil -0.6925869  1.3373455
Humdepth -0.9968279  1.4290890
pH        0.7037755 -1.3647204
attr(,"const")
[1] 4.236078
PC1        PC2
N         0.4008477  0.5267927
P        -1.5075888 -0.8781843
K        -1.5384951 -0.6850869
Ca       -1.5239497 -0.3582552
Mg       -1.4922949 -0.4141239
S        -1.4083631 -1.2567985
Al        0.4893605 -2.0353607
Fe        0.8599106 -1.6224771
Mn       -1.2181461  0.8183585
Zn       -1.4658174 -0.6861639
Mo       -0.1759892 -0.9685048
Baresoil -0.6925869  1.3373455
Humdepth -0.9968279  1.4290890
pH        0.7037755 -1.3647204

So we are able to recover exactly the correct scores - you just need to
draw arrows (perhaps using ordiArrow()) from (0,0) to those coordinates.

I don't think `evnfit()` is the right approach here, especially trying to
fake this via `ordiArrowMul()` as that is trying to fill the space and in
scaling 1 you need to scale variables independently.

HTH

Gavin
On 12 September 2014 12:06, ADuranel <arnaud.duranel.09 at ucl.ac.uk> wrote: