Analysis of variance using distance matrices — for partitioning distance matrices among sources of variation and fitting linear models (e.g., factors, polynomial regression) to distance matrices; uses a permutation test with pseudo-F ratios.
1 2 3
a typical model formula such as
the data frame from which
a list of control values for the permutations
as returned by the function
the name of any method used in
groups (strata) within which to constrain permutations.
contrasts used for the design matrix (default in R is dummy or treatment contrasts for unordered factors).
Number of parallel processes or a predefined socket
Other arguments passed to
adonis is a function for the analysis and partitioning
sums of squares using semimetric and metric distance matrices. Insofar
as it partitions sums of squares of a multivariate data set, it is
directly analogous to MANOVA (multivariate analysis of
variance). M.J. Anderson (McArdle and Anderson 2001, Anderson 2001) refers to the
method as “permutational manova” (formerly “nonparametric manova”). Further, as its inputs are
linear predictors, and a response matrix of an arbitrary number of
columns (2 to millions), it is a robust alternative to both parametric
MANOVA and to ordination methods for describing how variation is
attributed to different experimental treatments or uncontrolled
covariates. It is also analogous to redundancy analysis (Legendre and
Typical uses of
adonis include analysis of ecological community
data (samples X species matrices) or genetic data where we might have a
limited number of samples of individuals and thousands or millions of
columns of gene expression data (e.g. Zapala and Schork 2006).
adonis is an alternative to AMOVA (nested analysis of molecular
variance, Excoffier, Smouse, and Quattro, 1992;
amova in the ade4 package) for both crossed
and nested factors.
If the experimental design has nestedness, then use
test hypotheses. For instance, imagine we are testing whether a
plant community is influenced by nitrate amendments, and we have two
replicate plots at each of two levels of nitrate (0, 10 ppm). We have
replicated the experiment in three fields with (perhaps) different
average productivity. In this design, we would need to specify
strata = field so that randomizations occur only within
each field and not across all fields . See example below.
Like AMOVA (Excoffier et al. 1992),
adonis relies on a
long-understood phenomenon that allows one to partition sums of squared
deviations from a centroid in two different ways (McArdle and Anderson
2001). The most widely recognized method, used, e.g., for ANOVA and
MANOVA, is to first identify the relevant centroids and then to
calculated the squared deviations from these points. For a centered
n x p response matrix Y, this method uses the
p x p inner product matrix Y'Y. The less
appreciated method is to use the n x n outer product
matrix YY'. Both AMOVA and
adonis use this latter
method. This allows the use of any semimetric (e.g. Bray-Curtis, aka
Steinhaus, Czekanowski, and Sørensen) or metric
(e.g. Euclidean) distance matrix (McArdle and Anderson 2001). Using
Euclidean distances with the second method results in the same analysis
as the first method.
Significance tests are done using F-tests based on sequential sums
of squares from permutations of the raw data, and not permutations of
residuals. Permutations of the raw data may have better small sample
characteristics. Further, the precise meaning of hypothesis tests will
depend upon precisely what is permuted. The strata argument keeps groups
intact for a particular hypothesis test where one does not want to
permute the data among particular groups. For instance,
strata = B
causes permutations among levels of
A but retains data within
B (no permutation among levels of
permutations for additional details on permutation tests
contrasts are different than in R in
general. Specifically, they use “sum” contrasts, sometimes known
as “ANOVA” contrasts. See a useful text (e.g. Crawley,
2002) for a transparent introduction to linear model contrasts. This
choice of contrasts is simply a personal
pedagogical preference. The particular contrasts can be set to any
contrasts specified in R, including Helmert and treatment
Rules associated with formulae apply. See "An Introduction to R" for an overview of rules.
print.adonis shows the
aov.tab component of the output.
This function returns typical, but limited, output for analysis of variance (general linear models).
Typical AOV table showing sources of variation, degrees of freedom, sequential sums of squares, mean squares, F statistics, partial R-squared and P values, based on N permutations.
matrix of coefficients of the linear model, with rows representing sources of variation and columns representing species; each column represents a fit of a species abundance to the linear model. These are what you get when you fit one species to your predictors. These are NOT available if you supply the distance matrix in the formula, rather than the site x species matrix
matrix of coefficients of the linear model, with rows representing sources of variation and columns representing sites; each column represents a fit of a sites distances (from all other sites) to the linear model. These are what you get when you fit distances of one site to your predictors.
an N by m matrix of the null F
statistics for each source of variation based on N
permutations of the data. The permutations can be inspected with
Anderson (2001, Fig. 4) warns that the method may confound
location and dispersion effects: significant differences may be caused
by different within-group variation (dispersion) instead of different
mean values of the groups (see Warton et al. 2012 for a general
analysis). However, it seems that
adonis is less sensitive to
dispersion effects than some of its alternatives (
betadisper is a sister
adonis to study the differences in dispersion
within the same geometric framework.
Martin Henry H. Stevens [email protected]ohio.edu, adapted to vegan by Jari Oksanen.
Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.
Crawley, M.J. 2002. Statistical Computing: An Introduction to Data Analysis Using S-PLUS
Excoffier, L., P.E. Smouse, and J.M. Quattro. 1992. Analysis of molecular variance inferred from metric distances among DNA haplotypes: Application to human mitochondrial DNA restriction data. Genetics, 131:479–491.
Legendre, P. and M.J. Anderson. 1999. Distance-based redundancy analysis: Testing multispecies responses in multifactorial ecological experiments. Ecological Monographs, 69:1–24.
McArdle, B.H. and M.J. Anderson. 2001. Fitting multivariate models to community data: A comment on distance-based redundancy analysis. Ecology, 82: 290–297.
Warton, D.I., Wright, T.W., Wang, Y. 2012. Distance-based multivariate analyses confound location and dispersion effects. Methods in Ecology and Evolution, 3, 89–101.
Zapala, M.A. and N.J. Schork. 2006. Multivariate regression analysis of distance matrices for testing associations between gene expression patterns and related variables. Proceedings of the National Academy of Sciences, USA, 103:19430–19435.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
data(dune) data(dune.env) adonis(dune ~ Management*A1, data=dune.env, permutations=99) ### Example of use with strata, for nested (e.g., block) designs. dat <- expand.grid(rep=gl(2,1), NO3=factor(c(0,10)),field=gl(3,1) ) dat Agropyron <- with(dat, as.numeric(field) + as.numeric(NO3)+2) +rnorm(12)/2 Schizachyrium <- with(dat, as.numeric(field) - as.numeric(NO3)+2) +rnorm(12)/2 total <- Agropyron + Schizachyrium dotplot(total ~ NO3, dat, jitter.x=TRUE, groups=field, type=c('p','a'), xlab="NO3", auto.key=list(columns=3, lines=TRUE) ) Y <- data.frame(Agropyron, Schizachyrium) mod <- metaMDS(Y) plot(mod) ### Hulls show treatment with(dat, ordihull(mod, group=NO3, show="0")) with(dat, ordihull(mod, group=NO3, show="10", col=3)) ### Spider shows fields with(dat, ordispider(mod, group=field, lty=3, col="red")) ### Correct hypothesis test (with strata) adonis(Y ~ NO3, data=dat, strata=dat$field, perm=999) ### Incorrect (no strata) adonis(Y ~ NO3, data=dat, perm=999)
Loading required package: permute Loading required package: lattice This is vegan 2.4-3 Call: adonis(formula = dune ~ Management * A1, data = dune.env, permutations = 99) Permutation: free Number of permutations: 99 Terms added sequentially (first to last) Df SumsOfSqs MeanSqs F.Model R2 Pr(>F) Management 3 1.4686 0.48953 3.2629 0.34161 0.02 * A1 1 0.4409 0.44089 2.9387 0.10256 0.02 * Management:A1 3 0.5892 0.19639 1.3090 0.13705 0.20 Residuals 12 1.8004 0.15003 0.41878 Total 19 4.2990 1.00000 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 rep NO3 field 1 1 0 1 2 2 0 1 3 1 10 1 4 2 10 1 5 1 0 2 6 2 0 2 7 1 10 2 8 2 10 2 9 1 0 3 10 2 0 3 11 1 10 3 12 2 10 3 Run 0 stress 0.03248018 Run 1 stress 0.1220157 Run 2 stress 0.03248021 ... Procrustes: rmse 8.465921e-05 max resid 0.0002226793 ... Similar to previous best Run 3 stress 0.03669575 Run 4 stress 0.03248024 ... Procrustes: rmse 8.018295e-05 max resid 0.0002075907 ... Similar to previous best Run 5 stress 0.03669584 Run 6 stress 0.03248017 ... New best solution ... Procrustes: rmse 2.125228e-05 max resid 4.842529e-05 ... Similar to previous best Run 7 stress 0.03248019 ... Procrustes: rmse 2.429663e-05 max resid 5.258833e-05 ... Similar to previous best Run 8 stress 0.03248028 ... Procrustes: rmse 0.0001012927 max resid 0.0002628411 ... Similar to previous best Run 9 stress 0.03248018 ... Procrustes: rmse 2.08818e-05 max resid 3.890347e-05 ... Similar to previous best Run 10 stress 0.03669573 Run 11 stress 0.03248023 ... Procrustes: rmse 8.914505e-05 max resid 0.0002318408 ... Similar to previous best Run 12 stress 0.03248017 ... Procrustes: rmse 1.011436e-05 max resid 2.601106e-05 ... Similar to previous best Run 13 stress 0.03669576 Run 14 stress 0.0324802 ... Procrustes: rmse 5.933878e-05 max resid 0.0001542295 ... Similar to previous best Run 15 stress 0.1619843 Run 16 stress 0.1619842 Run 17 stress 0.03248018 ... Procrustes: rmse 3.382356e-05 max resid 8.756129e-05 ... Similar to previous best Run 18 stress 0.0324803 ... Procrustes: rmse 0.0001319686 max resid 0.0003451238 ... Similar to previous best Run 19 stress 0.03248034 ... Procrustes: rmse 0.0001438231 max resid 0.0003732738 ... Similar to previous best Run 20 stress 0.03669567 *** Solution reached Call: adonis(formula = Y ~ NO3, data = dat, permutations = 999, strata = dat$field) Blocks: strata Permutation: free Number of permutations: 999 Terms added sequentially (first to last) Df SumsOfSqs MeanSqs F.Model R2 Pr(>F) NO3 1 0.026737 0.0267369 2.9 0.2248 0.011 * Residuals 10 0.092197 0.0092197 0.7752 Total 11 0.118934 1.0000 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Call: adonis(formula = Y ~ NO3, data = dat, permutations = 999) Permutation: free Number of permutations: 999 Terms added sequentially (first to last) Df SumsOfSqs MeanSqs F.Model R2 Pr(>F) NO3 1 0.026737 0.0267369 2.9 0.2248 0.094 . Residuals 10 0.092197 0.0092197 0.7752 Total 11 0.118934 1.0000 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.