fitsadC | R Documentation |
Fits probability distributions for abundances of species aggregated in abundance classes in a sample or assemblage by maximum likelihood.
fitsadC(x, sad = c("exp","gamma","lnorm","pareto", "weibull"), ...)
fitexpC(x, trunc = NULL, start.value, ...)
fitgammaC(x, trunc, start.value, ...)
fitlnormC(x, trunc, start.value, ...)
fitparetoC(x, trunc, start.value, upper = 20, ...)
fitweibullC(x, trunc, start.value, ...)
x |
object of class |
sad |
character; root name of community sad distribution to be fitted. "exp" for exponential distribution, "gamma" for gamma distribution, "lnorm" for lognormal, "pareto" for Pareto distribution, "weibull" for Weibull distribution. |
trunc |
non-negative integer, |
start.value |
named numeric vector; starting values of free parameters to be
passed to |
upper |
real positive; upper bound for Brent's one-parameter optimization
method (default), for fits that use this method by default. See
details and |
... |
in |
fitsadC
is simply a wrapper that calls the specific
functions to fit the distribution chosen with the argument
sad
. Users can interchangeably use fitsadC
or the
individual functions detailed below (e.g. fitsad(x, sad="exp",
...)
is the same as fitexpC(x, ...)
and so on).
The distributions are fitted by the maximum likelihood method using
numerical optimization, with mle2
. The resulting object is of
fitsadC-class
which can be handled with mle2
methods for
fitted models and has also some additional methods for SADs models
(see fitsadC-class
and examples).
For counts of species in abundances classes the likelihood function is
L(\theta) = \sum^C n_i \ln P_i
for
i = 1, 2, 3, ... C, where C is the number of abundance classes,
n_i
is the number of species in abundance class i.
P_i
is the probability attributed by the distribution model
to the observation of one species in class i, which depends on the
vector \theta
of free parameters of the distribution model:
P_i = \int_{L_i}^{U_i} F(x \mid \theta) dx
where F(x|theta) is the value of the probability density function for a cover value x, under parameter values fixed at theta, and L_i and U_i are the lower and upper limits of the cover class i.
See fitsad
for descriptions of each distribution model.
An object of fitsadC-class
which inherits from mle2-class
and thus has methods for handling
results of maximum likelihood fits from mle2
and also specific methods to handle SADs models
(see fitsadC-class
).
Paulo I Prado prado@ib.usp.br, Murilo Dantas Miranda and Andre Chalom, after Ben Bolker, R Core Team.
all fitting functions builds on mle2
and methods
from bbmle package (Bolker 2012), which in turn builds on
mle
function and associated classes and methods.
Bolker, B. and R Development Core Team 2012. bbmle: Tools for general maximum likelihood estimation. R package version 1.0.5.2. http://CRAN.R-project.org/package=bbmle
Chapman, D. G. 1956. Estimating the parameters of a truncated gamma distribution. The Annals of Mathematical Statistics, 27(2): 498–506.
Magurran, A.E. 1989. Ecological diversity and its measurement. Princenton University Press.
Preston, F.W. 1948. The commonness and rarity of species. Ecology 29: 254–283.
Rinne, H. 2009. The Weibull distribution: a handbook. CRC Press
dpareto
,for corresponding density functions created for
fitting SADs; standard distributions dexp
, dgamma
,
dlnorm
, dweibull
;
fitsadC-class
.
## An example using data from Vieira et al, see dataset "grasslands"
## Breakpoints of the abundance classes used (cover classes)
vieira.brk <- c(0,1,3,5,seq(15,100, by=10),100)
## creates an histogram object
grass.h <- hist(grasslands$mids, breaks = vieira.brk, plot = FALSE)
#Fits Pareto, lognormal and gamma distributions
grass.p <- fitparetoC(grass.h)
grass.l <- fitlnormC(grass.h)
grass.g <- fitgammaC(grass.h)
## Predicted values by each model
grass.p.pred <- coverpred(grass.p)
grass.l.pred <- coverpred(grass.l)
grass.g.pred <- coverpred(grass.g)
## model selection
AICctab(grass.p, grass.l, grass.g, weights =TRUE, base = TRUE)
## A histogram with the densities predicted by each model
plot(grass.h, main = "", xlab = "Abundance (cover)")
## Adds predicted densities by each model to the plot
points(grass.p.pred, col = 1)
points(grass.l.pred, col = 2)
points(grass.g.pred, col = 3)
legend("topright", legend=c("Pareto","Log-normal", "Gamma"), col = 1:3, lty=1, pch =1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.