ppca {adephylo} | R Documentation |
These functions are designed to perform a phylogenetic principal component analysis (pPCA, Jombart et al. in prep) and to display the results. As this method is not published yet, please email the author before using it.
ppca
performs the phylogenetic component analysis. Other
functions are:
- print.ppca
: prints the ppca content
- summary.ppca
: provides useful information about a ppca
object, including the decomposition of eigenvalues of all axes
- scatter.ppca
: plot principal components using
table.phylo4d
- screeplot.ppca
: graphical display of the decomposition of
pPCA eigenvalues
- plot.ppca
: several graphics describing a ppca object
ppca(x, prox=NULL, method=c("patristic","nNodes","oriAbouheif","Abouheif","sumDD"), a=1, center=TRUE, scale=TRUE, scannf=TRUE, nfposi=1, nfnega=0) ## S3 method for class 'ppca': print(x, ...) ## S3 method for class 'ppca': summary(object, ..., printres=TRUE) ## S3 method for class 'ppca': scatter(x, axes = 1:ncol(x$li), useLag = FALSE,...) ## S3 method for class 'ppca': screeplot(x, ..., main=NULL) ## S3 method for class 'ppca': plot(x, axes = 1:ncol(x$li), useLag=FALSE, ...)
x |
a phylo4d object (for ppca ) or a ppca
object (for other methods). |
prox |
a marix of phylogenetic proximities as returned by
proxTips . If not provided, this matrix will be
constructed using the arguments method and a . |
method |
a character string (full or abbreviated without
ambiguity) specifying the method used to compute proximities;
possible values are: - patristic : (inversed sum of) branch lengths - nNodes : (inversed) number of nodes on the path between the
nodes - oriAbouheif : original Abouheif's proximity, with diagonal (see details in proxTips ) - Abouheif : Abouheif's proximity (see details in proxTips ) - sumDD : (inversed) sum of direct descendants of all nodes on the path
(see details in proxTips ). |
a |
the exponent used to compute the proximity (see ?proxTips ). |
center |
a logical indicating whether traits should be centred to mean zero (TRUE, default) or not (FALSE). |
scale |
a logical indicating whether traits should be scaled to unit variance (TRUE, default) or not (FALSE). |
scannf |
a logical stating whether eigenvalues should be chosen interactively (TRUE, default) or not (FALSE). |
nfposi |
an integer giving the number of positive eigenvalues retained ('global structures'). |
nfnega |
an integer giving the number of negative eigenvalues retained ('local structures'). |
... |
further arguments passed to other methods. Can be used to
provide arguments to table.phylo4d in plot method. |
object |
a ppca object. |
printres |
a logical stating whether results should be printed on the screen (TRUE, default) or not (FALSE). |
axes |
the index of the principal components to be represented. |
useLag |
a logical stating whether the lagged components
(x\$ls ) should be used instead of the components
(x\$li ). |
main |
a title for the screeplot; if NULL, a default one is used. |
The phylogenetic Principal Component Analysis (pPCA, Jombart et al.,
in prep) is derived from the spatial Principal Component Analysis
(spca, Jombart et al. 2008), implemented in the adegenet package (see
spca
).
pPCA is designed to investigate phylogenetic patterns in the variability of a set of
traits. The analysis returns principal components maximizing the
product of variance and phylogenetic autocorrelation (Moran's
I), therefore reflecting biodemographic strategies that are linked
to the phylogeny. Large positive and large negative eigenvalues
correspond to global and local structures.
The class ppca
are given to lists with the following
components:
eig |
a numeric vector of eigenvalues. |
nfposi |
an integer giving the number of global structures retained. |
nfnega |
an integer giving the number of local structures retained. |
c1 |
a data.frame of loadings of traits for each axis. |
li |
a data.frame of coordinates of taxa onto the ppca axes (i.e., principal components). |
ls |
a data.frame of lagged prinpal components; useful to represent of global scores. |
as |
a data.frame giving the coordinates of the axes of an 'ordinary' PCA onto the ppca axes. |
call |
the matched call. |
tre |
a phylogenetic tre with class phylo4. |
prox |
a matrix of phylogenetic proximities. |
Other functions have different outputs:
- scatter.ppca
returns the matched call.
Thibaut Jombart tjombart@imperial.ac.uk
Jombart, T.; Pavoine, S.; Dufour, A.-B. & Pontier, D. (in prep)
Exploring phylogeny as a source of ecological variation: a
methodological approach
Jombart, T., Devillard, S., Dufour, A.-B. and Pontier, D. Revealing cryptic phylogenetic patterns in genetic variability by a new multivariate method. Heredity, 101, 92–103.
Wartenberg, D. E. (1985) Multivariate phylogenetic correlation: a method for exploratory geographical analysis. Geographical Analysis, 17, 263–283.
Moran, P.A.P. (1948) The interpretation of statistical maps. Journal of the Royal Statistical Society, B 10, 243–251.
Moran, P.A.P. (1950) Notes on continuous stochastic phenomena. Biometrika, 37, 17–23.
de Jong, P. and Sprenger, C. and van Veen, F. (1984) On extreme values of Moran's I and Geary's c. Geographical Analysis, 16, 17–24.
The implementation of spca
in the
adegenet package (adegenet
)
## build an look at data data(maples) tre <- read.tree(text=maples$tre) x <- phylo4d(tre, maples$tab) omar <- par("mar") par(mar=rep(.1,4)) table.phylo4d(x, cex.lab=.5, cex.sym=.6, ratio=.1) # note NAs in last trait ('x') ## function to replace NA f1 <- function(vec){ if(any(is.na(vec))){ m <- mean(vec, na.rm=TRUE) vec[is.na(vec)] <- m } return(vec) } ## compute a PCA dat <- apply(maples$tab,2,f1) # replace NAs x.noNA <- phylo4d(tre, as.data.frame(dat)) if(require(ade4)){ ppca1 <- ppca(x.noNA, scannf=FALSE, method="Abouheif") ppca1 ## some graphics screeplot(ppca1) scatter(ppca1, useLag=TRUE) plot(ppca1, useLag=TRUE) ## most structured traits a <- ppca1$c1[,1] # loadings on PC 1 names(a) <- row.names(ppca1$c1) highContrib <- a[a< quantile(a,0.1) | a>quantile(a,0.9)] datSel <- cbind.data.frame(dat[, names(highContrib)], ppca1$li) temp <- phylo4d(tre, datSel) table.phylo4d(temp) # plot of most structured traits ## phylogenetic autocorrelation tests for these traits prox <- proxTips(tre, method="Abouheif") gearymoran(prox, dat[, names(highContrib)]) # one test per trait }