Package 'MLpreemption'

Title: Maximum Likelihood Estimation of the Niche Preemption Model
Description: Provides functions for obtaining estimates of the parameter of the niche preemption model (also known as the geometric series), in particular a maximum likelihood estimator (Graffelman, 2021) <doi:10.1101/2021.01.27.428381>. The niche preemption model is a widely used model in ecology and biodiversity studies.
Authors: Jan Graffelman [aut, cre]
Maintainer: Jan Graffelman <[email protected]>
License: GPL (>= 2)
Version: 1.0.1
Built: 2024-11-19 05:10:09 UTC
Source: https://github.com/cran/MLpreemption

Help Index


Australian bird abudances.

Description

The data sets consists of the names and abundances of 31 Australian birds.

Usage

data("Fattorini")

Format

A data frame with 31 observations on the following 2 variables.

Species

a character vector

Abundance

a numeric vector

References

Fattorini, S. (2005) A simple method to fit geometric series and broken stick models in community ecology and island biogeography. Acta Oecologica 28: pp. 199-205.

Examples

data(Fattorini)

Indian dung beetles from Ganeshaiah et al. (1997)

Description

The data sets consists of the names and abundances of 16 dung beetles

Usage

data(Ganeshaiah)

Format

A data frame with 16 observations on the following 2 variables.

Species

a character vector

Abundance

a numeric vector

References

Ganeshaiah, K.N., Chandrashekara, K. and Kuma A.R.V. (1997) Avalanche index: a new measure of biodiversity based on biological heterogeneity of the communities. Current Science 73, pp. 128-133.

Magurran, A.E. (2004) Measuring biological diversity, Blackwell Publishing, Oxford, UK.

Examples

data(Ganeshaiah)

Preemption parameter estimation by He and Tang

Description

Calculates the He-Tang estimator for the geometric series.

Usage

k_hetang(x)

Arguments

x

A vector of counts

Value

a real number

Note

Zero counts are discarded prior to calculation of the estimator.

Author(s)

Jan Graffelman ([email protected])

References

He, F. and Tang, D. 2008. Estimating the niche preemption parameter of the geometric series. Acta Oecologica, 33:105–107

See Also

k_ls,k_ml,k_may

Examples

data("Ganeshaiah")
x <- Ganeshaiah[,2]
k_hetang(x)

Preemption parameter estimation by least squares regression

Description

Calculates the least-squares estimator for the geometric series.

Usage

k_ls(x)

Arguments

x

A vector of ordered counts (from large to small)

Value

khat

estimate of the preemption parameter

k.ll

lower limit of the confidence interval

k.ul

upper limit of the confidence interval

aic

Akaike's information criterion

logl

log-likelihoood

Note

counts should be ordered from large to small.

Author(s)

Jan Graffelman ([email protected])

References

Magurran, A. 2004. Measuring biological diversity. Blackwell Publishing, Oxford, UK.

See Also

k_ml,k_hetang,k_may

Examples

data("Ganeshaiah")
x <- Ganeshaiah[,2]
k_ls(x)

Preemption parameter estimation by the equation of May

Description

Calculates the estimator of May for the geometric series.

Usage

k_may(xs, exclude = TRUE)

Arguments

xs

A vector of ordered counts

exclude

Automatically exclude zeros (if exclude=TRUE)

Details

Solves May equation by using uniroot.

Value

a real value

Note

counts should be ordered from large to small.

Author(s)

Jan Graffelman ([email protected])

References

May, R. 1975. Patterns of species abundance and diversity. In Cody, M. and Diamond, M., editors, Ecology and Evolution of Communities, pages 81–120. Harvard Univ. Press.

See Also

k_ls,k_hetang,k_ml

Examples

data("Ganeshaiah")
x <- Ganeshaiah[,2]
k_may(x)

Preemption parameter estimation by maximum likelihood.

Description

Calculates the maximum likelihood estimator for the geometric series.

Usage

k_ml(xs, closed = FALSE, ll = 0.001, ul = 0.999)

Arguments

xs

A vector of ordered counts (form large to small)

closed

If closed=TRUE a closed form approximation to the ML estimator will be calculated; otherwise the exact ML estimator is calculated iteratively.

ll

Lower limit for the root searching algorithm

ul

Upper limit for the root searching algorithm

Value

a real value

Note

counts should be ordered from large to small.

Author(s)

Jan Graffelman ([email protected])

References

Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model.

See Also

k_ls,k_hetang,k_may

Examples

data("Ganeshaiah")
x <- Ganeshaiah[,2]
k_ml(x)

Costa Rica dung beetle counts from Mehrabi et al. (2014)

Description

The data sets consists of the names and total abundances of 31 dung beetles along 16 transects (A, B, ... P). Transects A, C, ..., O used randomly placed traps (control), whereas transects B, D, ..., P used microhabitat standardized traps (treatment).

Usage

data("Mehrabi")

Format

A data frame with 31 observations on the following 16 variables.

A

a numeric vector

B

a numeric vector

C

a numeric vector

D

a numeric vector

E

a numeric vector

F

a numeric vector

G

a numeric vector

H

a numeric vector

I

a numeric vector

J

a numeric vector

K

a numeric vector

L

a numeric vector

M

a numeric vector

N

a numeric vector

O

a numeric vector

P

a numeric vector

References

Mehrabi, Z., Slade, E.M., Solis, A. and Mann, D.J. (2014) The Importance of Microhabitat for Biodiversity Sampling (2014) PLoS ONE 9(12) e114015. doi 10.1371/journal.pone.0114015

Examples

data(Mehrabi)

Estimation of the preemption parameter of a geometric series by various methods

Description

Function preemption.fit can estimate the preemption parameter of a geometric series by four specifici methods, or list all estimates simultaneously for comparison.

Usage

preemption.fit(x, method = "ml", closed = FALSE, verbose = TRUE)

Arguments

x

Vector of counts (abundances of species)

method

Estimation method ("ml" = maximum likelihood, "ls" = least squares, "May" = May's equation, "HT" = He-Tang's equation, "all" = lists all four estimators)

closed

If closed=FALSE the exact value of the ML estimator will be calculated by iteration, if closed=TRUE a good closed-form approximation is given

verbose

The function is silent if verbose=FALSE or prints results if verbose=TRUE

Value

khat

the estimate of the preemption parameter

ll

lower limit of 95 confidence interval

ul

upper limit of 95 confidence interval

Author(s)

Jan Graffelman ([email protected])

References

Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model

See Also

preemption.t

Examples

data(Ganeshaiah)
preemption.fit(Ganeshaiah[,2])

Preemption t test

Description

Function preemption.t implements a t test for comparing the preemption parameters of the geometric series for two samples.

Usage

preemption.t(x1, x2, verbose = TRUE)

Arguments

x1

Species counts for the first sample

x2

Species counts for the second sample

verbose

The function is silent if verbose=FALSE or prints results if verbose=TRUE

Value

Tstat

The t statistic

df

The degrees of freedom

pval

The p-value of the test

Author(s)

Jan Graffelman ([email protected])

References

Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model

See Also

preemption.fit

Examples

data(Mehrabi)
x <- sort(Mehrabi[,1],decreasing=TRUE)
y <- sort(Mehrabi[,2],decreasing=TRUE)
results <- preemption.t(x,y)

Rank-abundance plot

Description

Function raplot creates a rank-abundance plot online, and can show decaying lines fitted by various method.

Usage

raplot(x, xlab = "Species rank", ylab = "log (Relative abundance)",
       main = "Rank-Abundance plot", reflines = c(1, 2, 3, 4), alpha = 0.05, leg = FALSE)

Arguments

x

Vector of counts (species abundances)

xlab

Label for the x axis

ylab

Label for the y axis

main

Title for the plot

reflines

Lines to be drawn in the plot: 1=ML, 2=LS, 3=May, 4=He-Tang

alpha

Signifance level (0.05 by default)

leg

Show legend leg=TRUE or not leg=FALSE

Value

NULL

Author(s)

Jan Graffelman ([email protected])

References

Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model

Examples

data(Fattorini)
raplot(Fattorini[,2])

Rank-abundance plot for two samples

Description

Function raplot.paired creates a rank-abundance plot on screen, and can show decaying lines with uncertainty zones for two samples fitted by maximum likelihood.

Usage

raplot.paired(x, y, xlab = "Species rank", ylab = "log (Relative abundance)",
              main = "Rank-abundance", sym = c(1, 2), alpha = 0.05)

Arguments

x

Count vector of the first sample

y

Count vector of the second sample

xlab

Label x axis

ylab

Label y axis

main

Main title for the plot

sym

Symbols for first and second sample (c(1,2) by default)

alpha

Significance level (0.05 by default)

Value

NULL

Author(s)

Jan Graffelman ([email protected])

References

Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model

See Also

raplot

Examples

data("Mehrabi")
raplot.paired(Mehrabi[,1],Mehrabi[,2])