vector_sample: Vector Sample Function

Description Usage Arguments Details Value Note References See Also Examples

View source: R/algorithms.R

Description

Takes an input binary vector and a weight vector. Reassigns 1s randomly in proportion to vector weights.

Usage

1
vector_sample(speciesData, weights)

Arguments

speciesData

binary vector representing species presences and absences.

weights

a vector of non-negative read numbers representing probabilistic weights for species occurrencs of the same length as speciesData.

Details

This function takes an input vector of binary presence-absence values and a vector of non-negative probability weights. Both vectors must be of identical length.

Value

Returns a re-ordered binary vector in which the occurrences are placed in cells with probabilities proportional to values given in weights.

Note

Several of the randomization algorithms use this function to assign species occurrences with probabilities that reflect species or site differences. It is an effective method for conditioning the marginal probabilities of a null matrix on independent measurements of site or species characteristics.

References

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

sim10 randomization algorithm.

Examples

1
myColonizer <- vector_sample(speciesData=rbinom(10,1,0.5),weights=runif(10))

EcoSimR documentation built on May 2, 2019, 7:26 a.m.