View source: R/collector.curve.R
| collector.curve | R Documentation |
Computes species accumulation (collector's) curves based on sample units (SUs). The function performs random resampling of the input matrix or data frame to estimate the expected species richness per number of SUs, with confidence intervals derived from multiple permutations.
collector.curve(
formula,
data,
x,
times = 1000,
replace = FALSE,
prob = 0.95,
spar = 0,
xlab,
ylab,
plot = TRUE,
long = FALSE,
theme = "theme_classic"
)
formula |
An optional formula specifying the relationship between taxa and sample units
(e.g., |
data |
A data frame containing the variables specified in |
x |
Species-by-sample matrix, with rows representing SUs and columns representing taxa
('wide format'). Can be either an abundance or presence–absence matrix. Ignored if
|
times |
Integer. Number of random permutations used in calculations. Default is 1000. Larger values (> 1000) yield more stable estimates. |
replace |
Logical. Indicates whether resampling is performed with replacement ( |
prob |
Numeric. Probability level used for computing confidence intervals around species accumulation (default = 0.95). |
spar |
Numeric. Controls the smoothing parameter for plotted confidence intervals via spline interpolation. Default = 0 (no smoothing). |
xlab |
Character. Label for the x-axis in the plot. Default = |
ylab |
Character. Label for the y-axis in the plot. Default = |
plot |
Logical. If |
long |
Logical. If |
theme |
Character string specifying the ggplot2 theme to apply
(e.g., |
Species accumulation curves are computed by sequentially adding sample units and recording
species richness across permutations. Confidence intervals are estimated from the empirical
distribution of resampled richness values. The plotted confidence intervals are smoothed
using spline interpolation if spar > 0.
It is recommended to assign the output to an object, as the complete output
(particularly with long = TRUE) can be large.
If long = FALSE (default), returns a data frame with columns:
n: number of sample units.
s: mean number of species.
lower: lower confidence interval bound.
upper: upper confidence interval bound.
If long = TRUE, returns a list with:
matrix.s: full matrix of species richness per permutation.
s: the summarized data frame described above.
With long = TRUE, the function provides access to the complete set of resampling
results, useful for additional data analyses.
Rodrigo Augusto Santinelo Pereira raspereira@usp.br
Adriano Sanches Melo
Magurran, A. E. (1988). Ecological Diversity and Its Measurement. Croom Helm.
Magurran, A. E. (2004). Measuring Biological Diversity. Blackwell Publishing.
## Using 'formula' (long format)
## Without smoothing confidence intervals
collector.curve(
formula = Species ~ Plot - Morta,
data = quadrat.df,
times = 1000, long = FALSE, plot = TRUE
)
## Smoothing confidence intervals
collector.curve(
formula = Species ~ Plot - Morta,
data = quadrat.df,
spar = 0.6, times = 1000, long = FALSE, plot = TRUE
)
## Using different plot themes
collector.curve(
formula = Species ~ Plot - Morta,
data = quadrat.df,
times = 1000, long = FALSE, plot = TRUE, theme = "theme_light"
)
collector.curve(
formula = Species ~ Plot - Morta,
data = quadrat.df,
times = 1000, long = FALSE, plot = TRUE, theme = "theme_bw"
)
collector.curve(
formula = Species ~ Plot - Morta,
data = quadrat.df,
times = 1000, long = FALSE, plot = TRUE, theme = "theme_minimal"
)
## Using a matrix (wide format)
data.matrix <- with(
quadrat.df,
table(Plot, Species, exclude = "Morta")
)
collector.curve(x = data.matrix, times = 1000)
## Alternatively...
data.matrix <- as.matrix(
xtabs(~ Plot + Species, data = quadrat.df, exclude = "Morta")
)
collector.curve(x = data.matrix, times = 1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.