Variation partitioning of zeta diversity for a specific order (number of assemblages or sites) over distance and environmental variables.

1 2 3 4 5 6 | ```
Zeta.varpart(xy, data.spec, data.env, order = 2, sam = 1000,
distance.type = "Euclidean", dist.custom = NULL, method = "mean",
reg.type = "glm", family = stats::gaussian(),
method.glm = "glm.fit.cons", cons = -1, cons.inter = 1, kn = -1,
bs = "mpd", order.ispline = 2, kn.ispline = 1, rescale = FALSE,
rescale.pred = TRUE, normalize = FALSE)
``` |

`xy` |
Site coordinates. |

`data.spec` |
Site-by-species presence-absence data frame, with sites as rows and species as columns. |

`data.env` |
Site-by-variable data frame, with sites as rows and environmental variables as columns. |

`order` |
Specific number of assemblages or sites at which zeta diversity is computed. |

`sam` |
Number of samples for which the zeta diversity is computed. |

`distance.type` |
Method to compute distance. Default is " |

`dist.custom` |
Distance matrix provided by the user when |

`method` |
Name of a function (as a string) indicating how to combine the pairwise differences and distances for more than 3 sites. It can be a basic R-function such as " |

`reg.type` |
Type of regression for the multi-site generalised dissimilarity modelling. Options are "glm" for generalised linear models, "ngls" for negative linear models, "gam" for generalised additive models, "scam" for shape constrained additive models, and "ispline" for I-spline models, as recommended in generalised dissimilarity modelling by Ferrier |

`family` |
A description of the error distribution and link function to be used in the |

`method.glm` |
Method used in fitting the generalised linear model. The default method "glm.fit.cons" is an adaptation of method |

`cons` |
type of constraint in the glm if |

`cons.inter` |
type of constraint for the intercept. Default is 1 for positive intercept, suitable for Gaussian family. The other option is -1 for negative intercept, suitable for binomial family. |

`kn` |
Number of knots in the GAM and SCAM. Default is -1 for determining kn automatically using Generalized Cross-validation. |

`bs` |
A two-letter character string indicating the (penalized) smoothing basis to use in the scam model. Default is " |

`order.ispline` |
Order of the I-spline. |

`kn.ispline` |
Number of knots in the I-spline. |

`rescale` |
Boolean value (TRUE or FALSE) indicating if the zeta values should be divided by |

`rescale.pred` |
Boolean value (TRUE or FALSE) indicating if the spatial distances and differences in environmental variables should be rescaled between 0 and 1. |

`normalize` |
Boolean value (TRUE or FALSE) indicating if the zeta values for each sample should be divided by the total number of species for this specific sample. |

Note that, for a given regression, the variation explained is computed as 1-(RSS/TSS)*(v-1)/(v-p-1), where RSS is the residual sum of squares and TSS is the total sum of squares, v is the number of variables used in the regression (which is greater than the original number of variables for I-splines) and p is the number of samples. 1-(RSS/TSS) corresponds to the classical R-squared for linear regression only, and results for non-linear regressions should be interpreted with caution.

The environmental variables can be numeric or factorial, and `order`

must be greater than 1.

For numeric variables, the pairwise difference between sites is computed and combined according to `method`

. For factorial variables, the distance corresponds to the number of unique values over the number of assemblages of sites specified by `order`

.

Zeta is regressed against the differences of values of the environmental variables divided by the maximum difference for each variable, to be rescaled between 0 and 1. If `!is.null(xy)`

, distances between sites are also divided by the maximum distance.

`Zeta.varpart`

returns a data frame with one column containing the variation explained by each component `a`

(the variation explained by distance alone), `b`

(the variation explained by either distance or the environment), `c`

(the variation explained by the environment alone) and `d`

(the unexplained variation).

Hui C. & McGeoch M.A. (2014). Zeta diversity as a concept and metric that unifies incidence-based biodiversity patterns. *The American Naturalist*, 184, 684-694.

Borcard, D., Legendre, P. & Drapeau, P. (1992). Partialling out the spatial component of ecological variation. *Ecology* 73, 1045-1055.

Legendre, P. & Legendre, L.F. (2012). *Numerical ecology*, 3rd English edition. Elsevier Science BV, Amsterdam.

`Zeta.decline.mc`

, `Zeta.order.mc`

, `Zeta.decline.ex`

, `Zeta.order.ex`

, `Zeta.msgdm`

, `pie.neg`

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 | ```
utils::data(bird.spec.coarse)
xy.bird <- bird.spec.coarse[,1:2]
data.spec.bird <- bird.spec.coarse[,3:193]
utils::data(bird.env.coarse)
data.env.bird <- bird.env.coarse[,3:9]
zeta.varpart.bird <- Zeta.varpart(xy.bird, data.spec.bird, data.env.bird, order = 3, sam = 100)
zeta.varpart.bird
dev.new()
pie.neg(zeta.varpart.bird[4:7,1], density = c(4, 0, 8, -1),
angle = c(90, 0, 0, 0),
labels = c("distance", "undistinguishable", "environment", "unexplained"),
radius = 0.9)
##########
utils::data(Marion.species)
xy.marion <- Marion.species[,1:2]
data.spec.marion <- Marion.species[,3:33]
utils::data(Marion.env)
data.env.marion <- Marion.env[3:4]
zeta.varpart.marion <- Zeta.varpart(xy.marion, data.spec.marion, data.env.marion, order = 3,
sam = 100, normalize = TRUE)
zeta.varpart.marion
dev.new()
pie.neg(zeta.varpart.marion[4:7,1], density = c(4, 0, 8, -1),
angle = c(90, 0, 0, 0),
labels = c("distance", "undistinguishable", "environment", "unexplained"),
radius = 0.9)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.