Skip to contents

This is a community null model method for quantitative community data (e.g. abundance or occurrence probability). It is designed to adapt binary null model algorithms for use with quantitative data, which can be useful if there is not a quantitative-specific algorithm available that has the desired properties. For example, use with the binary "curveball" algorithm preserves row and column totals, and also approximately preserves the marginal distributions of rows and columns. For each randomization, the data set is split into strata representing numerical ranges of the input quantities, a separate binary randomization is done for each stratum, and the results are combined to produce a randomized, quantitative community matrix. See vegan::commsim() for details about other binary and quantitative null models.

Usage

quantize(x, method = "curveball", ...)

Arguments

x

Community matrix with species in rows, sites in columns, and nonnegative quantities in cells.

method

Null model algorithm, passed to vegan::nullmodel. Testing has only been done with the "curveball" algorithm, so other options should be use with caution. Only binary methods should be used.

...

Additional arguments, including:

  • n_strata: Integer giving the number of strata to split the data into. Must be 2 or greater. Larger values will result in randomizations with less mixing but higher fidelity to marginal distributions. The default is 5.

  • transform: A function used to transform the values in x before assigning them to n_strata equal intervals. Examples include sqrt, log, rank, etc.; the default is identity.

  • jitter: Number between 0 and 1, indicating how much to randomly jitter the location of stratum boundaries.

  • priority: Either "rows", "cols", or "neither", indicating whether randomization within strata should prioritize maintaining the marginal distributions of the rows or columns of the input matrix. The default, "neither", doesn't give precedence to either dimension. Note that this interacts with method, and methods differ in which margins are fixed.

  • Other arguments to be passed to simulate.nullmodel, such as seed or burnin. The default for burnin is 10000. Note that nsim and thin are ignored, as they're internally set to 1.

Value

A randomized version of x.

Examples

# \donttest{
# example quantitative community matrix
comm <- ps_get_comm(moss("polygon"), tips_only = TRUE, spatial = FALSE)[1:50, 1:50]

# examples of different quantize usage
rand <- quantize(comm)
rand <- quantize(comm, n_strata = 4, transform = sqrt, priority = "rows")
rand <- quantize(comm, method = "swap", burnin = 10)
# (note: this `burnin` value is far too small for a real analysis)
# }