betaRegDisp: Beta diversity metrics between sites in a moving window along...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/betaRegDisp.R

Description

The function computes eight metrics of beta diversity according to an informed environmental gradient. It selects a given number of environmentally-neighborhood sites in a moving window to obtain beta diversity.

Usage

1
2
3
4
betaRegDisp(y, x, xy.coords = NULL, ws = 3, 
            method.1 = "jaccard", method.2 = "ruzicka", 
            method.3 = "ruzicka", 
            independent.data = FALSE, illust.plot = FALSE)

Arguments

y

Response matrix, where rows are sites and columns are species.

x

Predictor vector. A vector of the environmental gradient under study with the same number of sites as in matrix y. Make sure the order of samples in y and x is the same.

xy.coords

Geographical coordinates. A matrix with two columns of XY decimal degree geographical coordinates, which are used to compute euclidean distance among sites. Rows must be sites in the same order as in y and x.

ws

Window size or number of sites to be used in the computation of the distinct beta-diversity metrics or between-site dissimilarities. It must be a positive integer higher than 2.

method.1

For beta-diversity metrics 1 to 3 (see details). A dissimilarity index available in the vegdist. The options are: "euclidean", "jaccard", "bray", "manhattan", "canberra", "kulczynski", "gower", "morisita", "horn", "mountford", "raup", "binomial", "chao", "altGower", "cao", "mahalanobis".

method.2

For beta-diversity metrics 4 and 5 (see details). A dissimilarity index available in the beta.div. The options are: "hellinger", "chord", "log.chord", "chisquare", "profiles", "percentdiff", "ruzicka", "divergence", "canberra", "whittaker", "wishart", "kulczynski", "jaccard", "sorensen", "ochiai", "ab.jaccard", "ab.sorensen", "ab.ochiai", "ab.simpson", "euclidean".

method.3

For beta-diversity metrics 6, 7, and 8 (see details). A multisample dissimilarity index available in the beta.multi.abund. The options are: "ruzicka" and "bray".

independent.data

Should windows not superpose each other? If independent.data=TRUE, sites do not enter more than once in the dissimilarity calculations, that is, sites are included in a single window.

illust.plot

Should a window plot be open and illustrate how the window moves along the gradient?

Details

The function computes eight beta-diversity metrics among sites included in a set (window) of length ws. See details in Dala-Corte et al. (2019).

Metrics 1-3 uses dissimilarity indices available in vegdist:

1. Mean pair-wise dissimilarity between sites in a window;

2. Mean dissimilarity between focal site and the other sites in a window. If an odd number is informed in ws, the focal site is the central site in relation to its neighbours in the window. If an even number is informed in ws, the focal site is the first site in the window;

3. Mean distance of sites to their group centroid in a Principal Coordinate (PCoA) space computed using betadisper;

Metrics 4-5 uses dissimilarity indices available in beta.div:

4. Total sum of squares (SS) of the window sites (Legendre and De Caceres, 2013);

5. Local contributions to beta diversity (LCBD; Legendre and De Caceres, 2013);

Metrics 6-8 uses dissimilarity indices available in beta.multi.abund:

6. Total multiple-site dissimilarities for a selected window of sites;

7. Nestedness component of multiple-site dissimilarities for a selected window of sites;

8. Turnover component of multiple-site dissimilarities for a selected window of sites.

Value

A matrix with 10 columns (or 12 if xy.coords is informed). Values in columns are sorted according to the enviromental gradient, from the lowest to the highest value. Columns correspond to:

1. grad - The environmental gradient (predictor vector, x);

2. mean.grad - Mean value of the environmental gradient of sites selected in each window;

3. mean.diss.pairs - Mean pair-wise dissimilarity between sites in a selected window (metric 1);

4. diss.focal - Mean dissimilarity between focal site and the other sites (metric 2);

5. mean.dist.cent - Mean distance of sites to their group centroid in a Principal Coordinate (PCoA) space (metric 3);

6. SS.group - Total sum of squares (SS) of the sites in a window (metric 4);

7. SS.focal - Local contributions to beta diversity (LCBD), which represents how much a focal site contributed to the total window SS;

8. beta.TOT - Total multiple-site dissimilarity;

9. beta.NES - Nestedness component of multiple-site dissimilarity;

10. beta.TUR - Turnover component of multiple-site dissimilarity;

11. mean.geodist - If xy.coords is provided, the mean linear euclidean distance between sites in the a window is returned.

12. focal.geodist - If xy.coords is provided, the mean linear euclidean distance of the focal site in relation to its neighbours in the window is returned.

Author(s)

Luciano F. Sgarbi, Renato B. Dala-Corte and Adriano S. Melo

References

Anderson, M.J., K.E. Ellingsen and B.H. McArdle. 2006. Multivariate dispersion as a measure of beta diversity. Ecology Letters 9: 683-693.

Baselga, A. 2010. Partitioning the turnover and nestedness components of beta diversity. Global Ecology and Biogeography 19: 134-143.

Baselga, A. 2017. Partitioning abundance-based multiple-site dissimilarity into components: balanced variation in abundance and abundance gradients. Methods in Ecology and Evolution 8: 799-808.

Dala-Corte, R.B., L.F. Sgarbi, F.G. Becker and A.S. Melo. 2019. Beta diversity of stream fish communities along anthropogenic environmental gradients at multiple spatial scales. Environmental Monitoring and Assessment 191:288.

Legendre, P. and M. De Caceres. 2013. Beta diversity as the variance of community data: dissimilarity coefficients and partitioning. Ecology Letters 16: 951-963.

See Also

vegdist, betadisper, beta.div, beta.multi

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## Example 1. A simmulated community matrix with a known structure of increasing
##  beta diversity by turnover
# n is the total sample sites
# LocS is the number of spp per site
# MaxS is the total number of spp in the matrix

# All samples will contain LocS species. The first sample will contain presences
# for the first LocS species. The subsequent samples will contain LocS presences
# spread over a increasing set of species. The assignment of presences for the
# second sample to the last sample is done randomly. The last sample will
# contain LocS presences assigned randomly to the MaxS species. Thus, for a 
# window size of 3 (ws=3) and a dataset of 10 samples, beta diversity for the
# samples 1-3 will be much lower than for samples 8-10.   

SimComm <- function(n = 21, MaxS = 30, LocS = 10){
    s <- seq (LocS, MaxS, length.out = n)
    mat <- matrix(0, n, MaxS, dimnames = 
                      list(paste("site", 1:n, sep = "_"), 
                           paste("sp", 1:MaxS, sep = "_")))
    for(i in 1:n){
        mat[i, sample(1:s[i], LocS)] <- 1
    }
    mat <- mat[, colSums(mat)!=0]
    return(mat)
}

mat <- SimComm(n = 21, MaxS = 30, LocS = 10)

#Creating an environmental gradient:
grad <- 1:nrow(mat)

b.resu <- betaRegDisp(y = mat, x = grad, xy.coord = NULL, ws = 3, 
                      method.1 = "jaccard", 
                      method.2 = "ruzicka",
                      method.3 = "ruzicka", 
                      independent.data = FALSE, illust.plot = FALSE)

##Ploting all the output of the object for the simmulated community
op <- par(no.readonly = TRUE)
par(mfrow = c(5, 2), oma = c(1, 0, 1, 0.1), mar = c(1.5, 3, .1, .1), cex = 1, las = 0)
for(i in 1:ncol(b.resu)){
  plot(b.resu[, 1], b.resu[, i], ylab = colnames(b.resu)[i], cex.lab = .9, 
       cex.axis = 0.9, tcl = -0.2, mgp = c(1.5, .2, 0), pch = 15, col = "grey")
}
mtext("Environmental gradient", cex = 1.3, 1, -0.1, outer = TRUE)
par(op)


## Not run: 
## Not run: 
##Example 2
data(varespec)
data(varechem)
grad <- varechem[, "Baresoil"]
resu <- betaRegDisp(y = varespec, x = grad, ws = 3, method.1 = "jaccard", 
            method.2 = "ruzicka", method.3 = "ruzicka", 
            independent.data = FALSE, illust.plot = FALSE)

#Plotting all the outputs of the function:
op <- par(no.readonly = TRUE)
par(mfrow = c(5, 2), oma = c(1, 0, 1, 0.1), mar = c(1.5, 3, .1, .1), cex = 1, las = 0)
for(i in 1:ncol(resu)){
  plot(resu[, 1], resu[, i], ylab = colnames(resu)[i], cex.lab = .9, 
       cex.axis = 0.9, tcl = -0.2, mgp = c(1.5, .2, 0), pch = 15, col = "grey")
}
mtext("Environmental gradient", cex = 1.3, 1, 0, outer = TRUE)
par(op)
## End(Not run)

## End(Not run)

CommEcol documentation built on March 16, 2021, 9:07 a.m.