Learn R Programming

EcoSimR (version 0.1.0)

sim10: Sim10 Co-occurrence Randomization Algorithm

Description

Randomizes a binary matrix speciesData by reshuffling all elements. Rows and column probabilities are proportional to user-supplied row and column weights, which define relative suitability probabilities for species and sites. Makes a call to the vector_sample function.

Usage

sim10(speciesData, rowWeights = runif(dim(speciesData)[1]), colWeights = runif(dim(speciesData)[2]))

Arguments

speciesData
binary presence-absence matrix (rows = species, columns = sites).
rowWeights
vector of positive values representing species weights.
colWeights
vector of positive values representing site weights.

Value

Returns a binary presence-absence matrix with the same dimensions and fill as the input matrix.

Details

This function incorporates vectors of weights for species and/or sites to condition the simulation. These two vectors are used as outer products to set cell probabilities for the entire matrix. Thus: $$p(cell_{ij})=p(row_i)p(col_j)$$ Weights must be positive real numbers. The algorithm will scale them so they sum to 1.0, so they can be used in their natural units (e.g. island area, species abudance), and will be scaled properly. If all species (or sites) are assumed to be equally likely, the weight vector should be set to the same constant for all elements.

References

Jenkins, D.G. 2006. In search of quorum effects in metacommunity structure: species co-occurrence analyses. Ecology 87:1523-1531

Gotelli, N.J., G.R. Graves, and C. Rahbek. 2010. Macroecological signals of species interactions in the Danish avifauna. Proceedings of the National Academy of Sciences, U.S.A. 107: 530-535.

See Also

vector_sample for weighted vector sampling.

Examples

Run this code
randomMatrix <- sim10(speciesData=matrix(rbinom(40,1,0.5),nrow=8))

Run the code above in your browser using DataLab