sad: Create a species abundance distribution

View source: R/sad.R

sadR Documentation

Create a species abundance distribution

Description

Function to create an object of class sad from data or theoretical predictions

Usage

sad(x, model, par, keepData = TRUE)

Arguments

x

vector of integers representing a sample of species abundances

model

character naming model to be fit (can only be length one)

par

vector of model parameters

keepData

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

Details

An object of class sad can be created one three ways:

Raw data

specifying only x will produce an sad object without any parametric model fit to it

Fit model

specifying both x and model will fit the model to the data and return an sad object with both empirical and theoretical predictions

Theoretical model

specifying both model and par will produce an sad object with only the theoretical prediction but no data

Note that this function behaves almost identically to fitSAD for the case when both x and model are spcified, but sad is more flexible allowing for unfit sad objects and specification of theoretical SADs without fitting of data by maximum likelihood.

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

data

The data

Author(s)

Andy Rominger <ajrominger@gmail.com>

See Also

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

Examples

x <- rtpois(1000, 2)
sad(x, model='tpois')


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