# adonis: Permutational Multivariate Analysis of Variance Using... In vegan: Community Ecology Package

## Description

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.

## Usage

 ```1 2 3 4 5 6``` ```adonis2(formula, data, permutations = 999, method = "bray", sqrt.dist = FALSE, add = FALSE, by = "terms", parallel = getOption("mc.cores"), strata, ...) adonis(formula, data, permutations = 999, method = "bray", strata = NULL, contr.unordered = "contr.sum", contr.ordered = "contr.poly", parallel = getOption("mc.cores"), ...) ```

## Arguments

 `formula` Model formula. The LHS must be either a community data matrix or a dissimilarity matrix, e.g., from `vegdist` or `dist`. If the LHS is a data matrix, function `vegdist` will be used to find the dissimilarities. The RHS defines the independent variables. These can be continuous variables or factors, they can be transformed within the formula, and they can have interactions as in a typical `formula`. If a dissimilarity object is supplied, no species coefficients can be calculated in `adonis` (see Value below). `data` the data frame for the independent variables. `permutations` a list of control values for the permutations as returned by the function `how`, or the number of permutations required, or a permutation matrix where each row gives the permuted indices. `method` the name of any method used in `vegdist` to calculate pairwise distances if the left hand side of the `formula` was a data frame or a matrix. `sqrt.dist` Take square root of dissimilarities. This often euclidifies dissimilarities. Implemented in `adonis2`, ignored in `adonis`. `add` Add a constant to the non-diagonal dissimilarities such that all eigenvalues are non-negative in the underlying Principal Co-ordinates Analysis (see `wcmdscale` for details). Choice `"lingoes"` (or `TRUE`) use the recommended method of Legendre & Anderson (1999: “method 1”) and `"cailliez"` uses their “method 2”. Implemented in `adonis2`, ignored in `adonis`. `by` `by = "terms"` will assess significance for each term (sequentially from first to last), setting `by = "margin"` will assess the marginal effects of the terms (each marginal term analysed in a model with all other variables), and ```by = NULL``` will assess the overall significance of all terms together. The arguments is passed on to `anova.cca`. Implemented in `adonis2`, ignored in `adonis`. `strata` groups (strata) within which to constrain permutations. NB. argument `strata` is DEPRECATED in `adonis2`: you should define similar structure (`blocks`) in `permutations`. See Examples for procedures in `adonis2`. `contr.unordered, contr.ordered` contrasts used for the design matrix (default in R is dummy or treatment contrasts for unordered factors). Ignored in `adonis2`. `parallel` Number of parallel processes or a predefined socket cluster. With `parallel = 1` uses ordinary, non-parallel processing. The parallel processing is done with parallel package. `...` Other arguments passed to `vegdist`.

## Details

`adonis2` and `adonis` are functions for the analysis and partitioning sums of squares using dissimilarities. Function `adonis` is directly based on the algorithm of Anderson (2001) and performs a sequential test of terms. Function `adonis2` is based on the principles of McArdle & Anderson (2001) and can perform sequential, marginal and overall tests. Function `adonis2` also allows using additive constants or squareroot of dissimilarities to avoid negative eigenvalues. but both functions can handle semimetric indices (such as Bray-Curtis) that produce negative eigenvalues. Function `adonis2` can be much slower than `adonis`, in particular with several terms. With the same random permutation, tests are identical in both functions, and the results are also identical to `anova.cca` of `dbrda` and `capscale`. With Euclidean distances, the tests are also identical to `anova.cca` of `rda`.

The functions partition sums of squares of a multivariate data set, and they are directly analogous to MANOVA (multivariate analysis of variance). McArdle and Anderson (2001) and Anderson (2001) refer to the method as “permutational manova” (formerly “nonparametric manova”). Further, as the inputs are linear predictors, and a response matrix of an arbitrary number of columns, they are a robust alternative to both parametric MANOVA and to ordination methods for describing how variation is attributed to different experimental treatments or uncontrolled covariates. Functions are also analogous to distance-based redundancy analysis in functions `dbrda` and `capscale` (Legendre and Anderson 1999). Functions provide 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.

## Value

Function `adonis2` returns an `anova.cca` result object with a new column for partial R-squared: This is the proportion of sum of squares from the total, and in marginal models (`by = "margin"`) the R-squared terms do not add up to 1.

Function `adonis` returns an object of class `"adonis"` with following components:

 `aov.tab` 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. `coefficients` 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 `coef.sites` 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. `f.perms` 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 `permustats` and its support functions. `model.matrix` The `model.matrix` for the right hand side of the formula. `terms` The `terms` component of the model.

## Note

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 (`anosim`, `mrpp`). Function `betadisper` is a sister function to `adonis` to study the differences in dispersion within the same geometric framework.

`adonis` and `adonis2` are different implementations and they do not share all arguments. If you use arguments of the wrong function, they may be silently ignored.

## Author(s)

Martin Henry H. Stevens (`adonis`) and Jari Oksanen (`adonis2`).

## References

Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.

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.

`mrpp`, `anosim`, `mantel`, `varpart`.

## Examples

 ``` 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 30 31``` ```data(dune) data(dune.env) ## default test by terms adonis2(dune ~ Management*A1, data = dune.env) ## overall tests adonis2(dune ~ Management*A1, data = dune.env, by = NULL) ### 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, trace = FALSE) plot(mod) ### Ellipsoid hulls show treatment with(dat, ordiellipse(mod, field, kind = "ehull", label = TRUE)) ### Spider shows fields with(dat, ordispider(mod, field, lty=3, col="red")) ### Incorrect (no strata) perm <- how(nperm = 199) adonis2 (Y ~ NO3, data = dat, permutations = perm) ## Correct with strata setBlocks(perm) <- with(dat, field) adonis2(Y ~ NO3, data = dat, permutations = perm) ```

### Example output

```Loading required package: permute
This is vegan 2.5-3
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 999

adonis2(formula = dune ~ Management * A1, data = dune.env)
Df SumOfSqs      R2      F Pr(>F)
Management     3   1.4686 0.34161 3.2629  0.001 ***
A1             1   0.4409 0.10256 2.9387  0.018 *
Management:A1  3   0.5892 0.13705 1.3090  0.224
Residual      12   1.8004 0.41878
Total         19   4.2990 1.00000
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999

adonis2(formula = dune ~ Management * A1, data = dune.env, by = NULL)
Df SumOfSqs      R2      F Pr(>F)
Model     7   2.4987 0.58122 2.3792  0.002 **
Residual 12   1.8004 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
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 199

adonis2(formula = Y ~ NO3, data = dat, permutations = perm)
Df SumOfSqs      R2     F Pr(>F)
NO3       1 0.065814 0.31172 4.529   0.03 *
Residual 10 0.145316 0.68828
Total    11 0.211130 1.00000
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Blocks:  with(dat, field)
Permutation: free
Number of permutations: 199

adonis2(formula = Y ~ NO3, data = dat, permutations = perm)
Df SumOfSqs      R2     F Pr(>F)
NO3       1 0.065814 0.31172 4.529  0.025 *
Residual 10 0.145316 0.68828
Total    11 0.211130 1.00000
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
```

vegan documentation built on Jan. 8, 2021, 2:12 a.m.