evopca {adiv} | R Documentation |
Evolutionary Principal Component analyses
Description
The functions evopcachord
and evopcahellinger
perform two adaptations of Principal Component Analysis (PCA) for the analysis of phylogenetic diversity patterns across species communities: the evolutionary PCA based on Chord distance (evoPCAChord) and the evolutionary PCA based on Hellinger distance (evoPCAHellinger) (Pavoine 2016).
Usage
evopcachord(phyl, comm, option = c("centred", "decentred"),
w = c("evoab", "even", "speciesab"), scannf = TRUE,
nf = 2, abundance = TRUE)
evopcahellinger(phyl, comm, option = c("centred", "decentred"),
w = c("evoab", "even", "speciesab"), scannf = TRUE,
nf = 2, abundance = TRUE)
Arguments
phyl |
an object inheriting the class |
comm |
a data frame or a matrix typically with communities as rows, species as columns and presence/absence (1/0) or an index of abundance as entries. Species should be labeled as in the phylogenetic tree where they are the tips. |
option |
a string: either |
w |
a string: either |
scannf |
a logical value indicating whether the screeplot (eigenvalues) should be displayed for choosing the number of axes to be kept. |
nf |
if |
abundance |
a logical value. If |
Details
Let be the length of branch k in the phylogenetic tree (out of K branches);
the sum of abundances, in community j, for all species descending from branch k;
a positive weight attributed to community j (the definition for
is flexible with the only requirement that
);
;
;
.
The weights of the communities (argument w
) can be "even"
(even weights, i.e. relative abundances
are considered for evolutionary units), "evoab"
(proportional to the summed abundances of all evolutionary units, i.e. absolute abundances are considered for evolutionary units), or "speciesab"
(proportional to the summed abundances of all species). Note that if the phylogenetic tree is ultrametric (the distance from any species to the root is constant), then options "evoab"
and "speciesab"
are equivalent.
In evopcahellinger
, as recommended by Rao (1995), the vector used to centre matrix in PCA can be defined as
(ordinary weighted mean, option "centered"
)
or as
(option "decentered"
); see Pavoine (2016) for an introduction of all ordination approaches.
Similarly, in evopcachord
, the vector used to centre matrix can be defined as
(ordinary weighted mean, option "centered"
)
or as
(option "decentered"
).
Value
evopcachord
and evopcahellinger
both return an object of class evopca
and of class dudi
(see package ade4). Graphical tools are associated with class dudi
in packages ade4 and adegraphics (see section "Examples" below).
The returned object contains the following components:
tab |
a data frame with n rows and p columns, with communities as rows and nodes of the phylogeny as columns. Internal data frame used by the algorithm; |
cw |
weights attributed to the nodes of the phylogeny, a vector with p components; |
lw |
weights attributed to the communities, a vector with n components; |
eig |
vector of eigenvalues; |
rank |
integer, number of axes; |
nf |
integer, number of kept axes; |
c1 |
normed scores for the nodes of the phylogeny, data frame with p rows and nf columns; |
l1 |
normed scores for the communities, data frame with n rows and nf columns; |
co |
scores for the nodes of the phylogeny, data frame with p rows and nf columns; |
li |
scores for the communities, data frame with n rows and nf columns; |
call |
the original call. |
If X is an object of class evopca
, then attributes(X)$phy
contains the phylogenetic tree (of class phylo
) with names for internal nodes.
Author(s)
Sandrine Pavoine sandrine.pavoine@mnhn.fr
References
Pavoine, S. (2016) A guide through a family of phylogenetic dissimilarity measures among sites. Oikos, 125, 1719–1732.
Rao, C.R. (1995) A review of canonical coordinates and an alternative to correspondence analysis using Hellinger distance. Questiio, 19, 23–63.
See Also
Examples
## Not run:
if(require(ade4) && require(ape) && require(adegraphics)){
O <- adegpar()$plabels$optim
adegpar("plabels.optim" = TRUE)
data(batcomm)
ab <- batcomm$ab
phy <- read.tree(text=batcomm$tre)
plot(phy, show.node=TRUE)
evopcaHbat <- evopcahellinger(phy, ab, scan=FALSE, nf=3)
dist(evopcaHbat$li)
evodiss(phy, ab, "Hellinger")
evopcaHbat$eig/sum(evopcaHbat$eig)
s.label(evopcaHbat$li)
s.label(evopcaHbat$co)
s.arrow(evopcaHbat$co)
inertia.dudi(evopcaHbat, row=TRUE)$row.abs
inertia.dudi(evopcaHbat, col=TRUE)$col.abs
evopcaCbat <- evopcachord(phy, ab, scan=FALSE, nf=3)
dist(evopcaCbat$li)
evodiss(phy, ab, "Chord")
evopcaCbat$eig/sum(evopcaCbat$eig)
s.label(evopcaCbat$li)
s.label(evopcaCbat$co)
s.arrow(evopcaCbat$co)
inertia.dudi(evopcaCbat, row=TRUE)$row.abs
inertia.dudi(evopcaCbat, col=TRUE)$col.abs
adegpar("plabels.optim" = O)
}
## End(Not run)