custom header test
sim4(speciesData)
Randomizes a binary matrix speciesData by reshuffling elements within each row. Sampling weights for each column are proportional to column sums. Makes a call to the vector_sample function.
This algorithm preserves differences among species in occurrence frequencies, but assumes differences among sites in suitability are proportional to observed species richness (= column sums).
This algorithm preserves differences in the commonness and rarity of species (= rowsums), but assumes differences among sites in suitability are proportional to observed species richness (= column sums). sim4 has a somewhat high frequency of Type I errors with random matrices, so it is not recommended for co-occurrence analysis.
Gotelli, N.J. 2000. Null model analysis of species co-occurrence patterns. Ecology 81: 2606-2621.
randomMatrix <- sim4(speciesData = matrix(rbinom(40,1,0.5),nrow=8))