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 |
The data sets consists of the names and abundances of 31 Australian birds.
data("Fattorini")
data("Fattorini")
A data frame with 31 observations on the following 2 variables.
Species
a character vector
Abundance
a numeric vector
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.
data(Fattorini)
data(Fattorini)
The data sets consists of the names and abundances of 16 dung beetles
data(Ganeshaiah)
data(Ganeshaiah)
A data frame with 16 observations on the following 2 variables.
Species
a character vector
Abundance
a numeric vector
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.
data(Ganeshaiah)
data(Ganeshaiah)
Calculates the He-Tang estimator for the geometric series.
k_hetang(x)
k_hetang(x)
x |
A vector of counts |
a real number
Zero counts are discarded prior to calculation of the estimator.
Jan Graffelman ([email protected])
He, F. and Tang, D. 2008. Estimating the niche preemption parameter of the geometric series. Acta Oecologica, 33:105–107
data("Ganeshaiah") x <- Ganeshaiah[,2] k_hetang(x)
data("Ganeshaiah") x <- Ganeshaiah[,2] k_hetang(x)
Calculates the least-squares estimator for the geometric series.
k_ls(x)
k_ls(x)
x |
A vector of ordered counts (from large to small) |
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 |
counts should be ordered from large to small.
Jan Graffelman ([email protected])
Magurran, A. 2004. Measuring biological diversity. Blackwell Publishing, Oxford, UK.
data("Ganeshaiah") x <- Ganeshaiah[,2] k_ls(x)
data("Ganeshaiah") x <- Ganeshaiah[,2] k_ls(x)
Calculates the estimator of May for the geometric series.
k_may(xs, exclude = TRUE)
k_may(xs, exclude = TRUE)
xs |
A vector of ordered counts |
exclude |
Automatically exclude zeros (if |
Solves May equation by using uniroot
.
a real value
counts should be ordered from large to small.
Jan Graffelman ([email protected])
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.
data("Ganeshaiah") x <- Ganeshaiah[,2] k_may(x)
data("Ganeshaiah") x <- Ganeshaiah[,2] k_may(x)
Calculates the maximum likelihood estimator for the geometric series.
k_ml(xs, closed = FALSE, ll = 0.001, ul = 0.999)
k_ml(xs, closed = FALSE, ll = 0.001, ul = 0.999)
xs |
A vector of ordered counts (form large to small) |
closed |
If |
ll |
Lower limit for the root searching algorithm |
ul |
Upper limit for the root searching algorithm |
a real value
counts should be ordered from large to small.
Jan Graffelman ([email protected])
Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model.
data("Ganeshaiah") x <- Ganeshaiah[,2] k_ml(x)
data("Ganeshaiah") x <- Ganeshaiah[,2] k_ml(x)
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).
data("Mehrabi")
data("Mehrabi")
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
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
data(Mehrabi)
data(Mehrabi)
Function preemption.fit
can estimate the preemption parameter of a geometric series by four specifici methods, or list all estimates simultaneously for comparison.
preemption.fit(x, method = "ml", closed = FALSE, verbose = TRUE)
preemption.fit(x, method = "ml", closed = FALSE, verbose = TRUE)
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 |
verbose |
The function is silent if |
khat |
the estimate of the preemption parameter |
ll |
lower limit of 95 confidence interval |
ul |
upper limit of 95 confidence interval |
Jan Graffelman ([email protected])
Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model
data(Ganeshaiah) preemption.fit(Ganeshaiah[,2])
data(Ganeshaiah) preemption.fit(Ganeshaiah[,2])
Function preemption.t
implements a t test for comparing the preemption parameters of the geometric series for two samples.
preemption.t(x1, x2, verbose = TRUE)
preemption.t(x1, x2, verbose = TRUE)
x1 |
Species counts for the first sample |
x2 |
Species counts for the second sample |
verbose |
The function is silent if |
Tstat |
The t statistic |
df |
The degrees of freedom |
pval |
The p-value of the test |
Jan Graffelman ([email protected])
Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model
data(Mehrabi) x <- sort(Mehrabi[,1],decreasing=TRUE) y <- sort(Mehrabi[,2],decreasing=TRUE) results <- preemption.t(x,y)
data(Mehrabi) x <- sort(Mehrabi[,1],decreasing=TRUE) y <- sort(Mehrabi[,2],decreasing=TRUE) results <- preemption.t(x,y)
Function raplot
creates a rank-abundance plot online, and can show decaying lines fitted by various method.
raplot(x, xlab = "Species rank", ylab = "log (Relative abundance)", main = "Rank-Abundance plot", reflines = c(1, 2, 3, 4), alpha = 0.05, leg = FALSE)
raplot(x, xlab = "Species rank", ylab = "log (Relative abundance)", main = "Rank-Abundance plot", reflines = c(1, 2, 3, 4), alpha = 0.05, leg = FALSE)
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 |
NULL
Jan Graffelman ([email protected])
Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model
data(Fattorini) raplot(Fattorini[,2])
data(Fattorini) raplot(Fattorini[,2])
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.
raplot.paired(x, y, xlab = "Species rank", ylab = "log (Relative abundance)", main = "Rank-abundance", sym = c(1, 2), alpha = 0.05)
raplot.paired(x, y, xlab = "Species rank", ylab = "log (Relative abundance)", main = "Rank-abundance", sym = c(1, 2), alpha = 0.05)
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) |
NULL
Jan Graffelman ([email protected])
Graffelman, J. (2021) Maximum likelihood estimation of the geometric niche preemption model
data("Mehrabi") raplot.paired(Mehrabi[,1],Mehrabi[,2])
data("Mehrabi") raplot.paired(Mehrabi[,1],Mehrabi[,2])