Learn R Programming

BiodiversityR (version 2.16-1)

CAPdiscrim: Canonical Analysis of Principal Coordinates based on Discriminant Analysis

Description

This function provides a method for CAP that follows the procedure as described by the authors of the ordination method (Anderson & Willis 2003). The CAP method implemented in vegan through capscale conforms more to distance-based Redundancy Analysis (Legendre & Anderson, 1999) than to the original description for CAP (Anderson & Willis, 2003 ).

Usage

CAPdiscrim(formula, data, dist="bray", axes=4, 
    m=0, mmax=10, add=FALSE, 
    permutations=0,
    aitchison_pseudocount=1)

Value

The function returns an object with information on CAP based on discriminant analysis. The object contains following elements:

PCoA

the positions of the sites as fitted by PCoA

m

the number of axes analysed by discriminant analysis

tot

the total variance (sum of all eigenvalues of PCoA)

varm

the variance of the m axes that were investigated

group

the original group of the sites

CV

the predicted group for the sites by discriminant analysis

percent

the percentage of correct predictions

percent.level

the percentage of correct predictions for different factor levels

x

the positions of the sites provided by the discriminant analysis

F

the squares of the singulare values of the discriminant analysis

manova

the results for MANOVA with the same grouping variable

signi

the significance of the percentage of correct predictions

manova

a summary of the observed randomised prediction percentages

The object can be plotted with ordiplot, and species scores can be added by add.spec.scores .

Arguments

formula

Formula with a community data frame (with sites as rows, species as columns and species abundance as cell values) or distance matrix on the left-hand side and a categorical variable on the right-hand side (only the first explanatory variable will be used).

data

Environmental data set.

dist

Method for calculating ecological distance with function vegdist: partial match to "manhattan", "euclidean", "canberra", "bray", "kulczynski", "jaccard", "gower", "morisita", "horn", "mountford", "aitchison" and "robust.aitchison". This argument is ignored in case that the left-hand side of the formula already is a distance matrix.

axes

Number of PCoA axes (cmdscale) to provide in the result.

m

Number of PCoA axes to be investigated by discriminant analysis (lda). If m=0 then the number of axes that provides the best distinction between the groups is calculated (following the method of Anderson and Willis).

mmax

The maximum number of PCoA axes considered when searching (m=0) for the number of axes that provide the best classification success.

add

Add a constant to the non-diagonal dissimilarities such that the modified dissimilarities are Euclidean; see also cmdscale.

permutations

The number of permutations for significance testing.

aitchison_pseudocount

Pseudocount setting as in vegdist.

Author

Roeland Kindt (World Agroforestry Centre)

Details

This function provides a method of Constrained Analysis of Principal Coordinates (CAP) that follows the description of the method by the developers of the method, Anderson and Willis. The method investigates the results of a Principal Coordinates Analysis (function cmdscale) with linear discriminant analysis (lda). Anderson and Willis advocate to use the number of principal coordinate axes that result in the best prediction of group identities of the sites.

Results may be different than those obtained in the PRIMER-e package because PRIMER-e does not consider prior probabilities, does not standardize PCOA axes by their eigenvalues and applies an additional spherical standardization to a common within-group variance/covariance matrix.

For permutations > 0, the analysis is repeated by randomising the observations of the environmental data set. The significance is estimated by dividing the number of times the randomisation generated a larger percentage of correct predictions.

References

Legendre, P. & Anderson, M.J. (1999). Distance-based redundancy analysis: testing multispecies responses in multifactorial ecological experiments. Ecological Monographs 69: 1-24.

Anderson, M.J. & Willis, T.J. (2003). Canonical analysis of principal coordinates: a useful method of constrained ordination for ecology. Ecology 84: 511-525.

Kindt, R. & Coe, R. (2005) Tree diversity analysis: A manual and software for common statistical methods for ecological and biodiversity studies.

https://www.worldagroforestry.org/output/tree-diversity-analysis

Examples

Run this code

if (FALSE) {
library(vegan)
library(MASS)
data(dune)
data(dune.env)
# categorical variables should not be ordered
dune$Management <- factor(dune$Management, ordered=FALSE)
Ordination.model1 <- CAPdiscrim(dune~Management, data=dune.env,
    dist="bray", axes=2, m=0, add=FALSE)
Ordination.model1
plot1 <- ordiplot(Ordination.model1, type="none")
ordisymbol(plot1, dune.env, "Management", legend=TRUE)

# plot change in classification success against m
plot(seq(1:14), rep(-1000, 14), xlim=c(1, 14), ylim=c(0, 100), xlab="m", 
    ylab="classification success (percent)", type="n")
for (mseq in 1:14) {
    CAPdiscrim.result <- CAPdiscrim(dune~Management, data=dune.env, 
        dist="bray", axes=2, m=mseq)
    points(mseq, CAPdiscrim.result$percent)
}


}

Run the code above in your browser using DataLab