standardization by rows, the new species to be projected into the biplot should be
transformed using the same row sums and square-rooting as the data that have been
submitted to the PCA.
5.3.2.5 Projecting Supplementary Objects into a PCA Biplot
If the PCA has been computed as above, using vegan’s function rda(), function
predict() of package vegan cannot be used to project supplementary objects
into a PCA biplot, at least if one wants the positions of the new sites to be estimated
in the same way as those of the existing ones. The reason is that the output object of
rda() has two classes: ‘rda’ and ‘cca’, and in this case predict() recognizes the
class ‘cca’ and, accordingly, computes object scores as weighted averages of the
variables. This is only correct for a correspondence analysis (CA) biplot (see Sect.
5.4.2.2).
However, another function predict(), of package stats, provides the
correct site scores when the PCA is computed by some other R functions. As an
example, let us compute a PCA of the Doubs environment data without sites 2, 8 and
22, using function prcomp()
3 of package stats, and then project the position of
the missing sites in the ordination plot:
# PCA and projection of supplementary sites 2, 9 and 23 using
# prcomp() {stats} and predict( )
# Line numbers 8 and 22 are offset because of the deletion of
# empty site 8
# PCA using prcomp()
# Argument 'scale. = TRUE' calls for a PCA on a correlation matrix;
# it is equivalent to 'scale = TRUE' in function rda()
env.prcomp <- prcomp(env[-c(2, 8, 22), ], scale. = TRUE)
# Plot of PCA site scores using generic function plot()
plot(env.prcomp$x[ ,1], env.prcomp$x[ ,2], type = "n")
abline(h = 0, col = "gray")
abline(v = 0, col = "gray")
text(
env.prcomp$x[ ,1],
env.prcomp$x[ ,2],
labels = rownames(env[-c(2, 8, 22), ])
)
3 Do not use the alternative function princomp(), which computes variances with divisor
n instead of (n – 1).
5.3 Principal Component Analysis (PCA)
163
transformed using the same row sums and square-rooting as the data that have been
submitted to the PCA.
5.3.2.5 Projecting Supplementary Objects into a PCA Biplot
If the PCA has been computed as above, using vegan’s function rda(), function
predict() of package vegan cannot be used to project supplementary objects
into a PCA biplot, at least if one wants the positions of the new sites to be estimated
in the same way as those of the existing ones. The reason is that the output object of
rda() has two classes: ‘rda’ and ‘cca’, and in this case predict() recognizes the
class ‘cca’ and, accordingly, computes object scores as weighted averages of the
variables. This is only correct for a correspondence analysis (CA) biplot (see Sect.
5.4.2.2).
However, another function predict(), of package stats, provides the
correct site scores when the PCA is computed by some other R functions. As an
example, let us compute a PCA of the Doubs environment data without sites 2, 8 and
22, using function prcomp()
3 of package stats, and then project the position of
the missing sites in the ordination plot:
# PCA and projection of supplementary sites 2, 9 and 23 using
# prcomp() {stats} and predict( )
# Line numbers 8 and 22 are offset because of the deletion of
# empty site 8
# PCA using prcomp()
# Argument 'scale. = TRUE' calls for a PCA on a correlation matrix;
# it is equivalent to 'scale = TRUE' in function rda()
env.prcomp <- prcomp(env[-c(2, 8, 22), ], scale. = TRUE)
# Plot of PCA site scores using generic function plot()
plot(env.prcomp$x[ ,1], env.prcomp$x[ ,2], type = "n")
abline(h = 0, col = "gray")
abline(v = 0, col = "gray")
text(
env.prcomp$x[ ,1],
env.prcomp$x[ ,2],
labels = rownames(env[-c(2, 8, 22), ])
)
3 Do not use the alternative function princomp(), which computes variances with divisor
n instead of (n – 1).
5.3 Principal Component Analysis (PCA)
163
