fitSAD: Fit a model for a species abundance distribution

View source: R/fitSAD.R

fitSADR Documentation

Fit a model for a species abundance distribution

Description

fitSAD uses maximum likelihood to fit one or several SAD models to data

Usage

fitSAD(
  x,
  models = c("lseries", "plnorm", "stick", "tnegb", "tpois", "untb"),
  keepData = TRUE
)

Arguments

x

vector of integers representing a sample of species abundances

models

character vector of models to be fit (can be more than one model, see examples)

keepData

logical, should the data be stored with the fitted sad object

Details

The default behavior fits all models available in pika:

lseries

Log series

plnorm

Poisson log normal

stick

Broken stick

tnegb

Truncated negative binomial

tpois

Truncated Poisson

untb

Unified Neutral Theory of Biodiversity

Exact solutions are availible for tpois and stick. In the case of lseries, optimization is used to solve \bar{x} = \frac{-1}{log(1-e^{-β})}\frac{e^{-β}}{1-e^{-β}}. For plnorm and tnegb optimization is used to maximize the log likelihood functions based directly on dplnorm and dtnegb, respectively.

Value

A list containing named objects of class sad with elements

MLE

The maximum likelihood estimate(s)

ll

The maximized log likelihood

df

The associated degrees of freedom

nobs

The associated number of observations

model

The name of the model fit

Author(s)

Andy Rominger <ajrominger@gmail.com>

See Also

logLik.sad, dlseries, dplnorm, dstick, dtnegb, dtpois

Examples

x <- rtpois(1000, 2)
fitSAD(x, models='tpois')


ajrominger/pika documentation built on Nov. 13, 2022, 8:22 a.m.