size_gamma: SizeGamma Size Overlap Randomization Algorithm

Description Usage Arguments Value Note See Also Examples

View source: R/algorithms.R

Description

Function to generate a random distribution of body sizes by drawing from a gamma distribution. Shape and rate parameters of the gamma are estimated from the empirical data.

Usage

1
size_gamma(speciesData = rnorm(50, mean = 100, sd = 1))

Arguments

speciesData

a vector of body sizes or other trait measurements of species. All values must be positive real numbers.

Value

Returns a vector of simulated body sizes as the same length as speciesData.

Note

The shape and rate parameters are estimated from the real data using the maximum likelihood estimators generated from the fitdr function in the MASS library. The flexible gamma distribution can be fit to a variety of normal, log-normal, and exponential distributions that are typical for trait data measured on a continuous non-negative scale.

See Also

fitdistr in the MASS library.

Examples

1
obsOverlap <- size_gamma(speciesData=rnorm(50,mean=100,sd=1))

EcoSimR documentation built on May 29, 2017, 9:11 p.m.

Search within the EcoSimR package
Search all R packages, documentation and source code