View source: R/mobr_boxplots.R
get_mob_stats | R Documentation |
This function can compute a range of biodiversity metrics, their uncertainty, and carries out a permutation test to examine if groups differ in a particular metric more than would be expected due to random chance.
get_mob_stats(
mob_in,
group_var,
index = c("N", "S", "S_n", "S_PIE"),
effort_samples = NULL,
effort_min = 5,
extrapolate = TRUE,
return_NA = FALSE,
rare_thres = 0.05,
scales = c("alpha", "gamma", "beta"),
PIE_replace = FALSE,
C_target_gamma = NA,
n_perm = 199,
cl = NULL,
ci = TRUE,
ci_cent_stat = "median",
ci_algo = "boot",
ci_n_boot = 1000,
quiet_mode = TRUE,
...
)
mob_in |
an object of class mob_in created by make_mob_in() |
group_var |
String that specifies which variable in |
index |
The calculated biodiversity indices. The options are
See Details for additional information on the biodiversity statistics. |
effort_samples |
An integer that specifies the standardized number of
individuals used for the calculation of rarefied species richness at the
alpha-scale. It must be a single integer. The default value of |
effort_min |
The minimum number of individuals considered for the
calculation of rarefied richness (Default value of 5). Samples with less
individuals then |
extrapolate |
Boolean which specifies if richness should be extrapolated when effort is larger than the number of individuals using the chao1 method (Chao 1984, 1987). Defaults to TRUE. |
return_NA |
Boolean in which the rarefaction function returns the
observed S when |
rare_thres |
The threshold that determines how the metric
|
scales |
The scales to compute the diversity indices for:
Defaults to all three scales: |
PIE_replace |
Used for |
C_target_gamma |
When computing coverage based richness ( |
n_perm |
number of iterations to run for null tests, defaults to 1000. |
cl |
A cluster object created by |
ci |
boolean, if TRUE then confidence intervals are calculated. Defaults to TRUE. |
ci_cent_stat |
a string that is either 'mean' or 'median' which specifies the measure of central tendency. Defaults to 'median'. |
ci_algo |
can be either 'boot' or 'loo' for bootstrap or leave-one-out methods respectively. Default value is 'boot'. |
quiet_mode |
boolean, defaults to TRUE in which case warnings from the diversity calculations are not returned. These are typically generated when calculating the metric SPIE which is undefined when all species are singletons. |
... |
additional arguments that can be passed to |
This function is partially a wrapper for the functions
calc_comm_div
or calc_comm_div_ci
that makes
group comparisons easier to implement.
See calc_comm_div
for more details on the biodiversity indices.
Group comparison metric and test
For each metric group comparison the function computes D_bar
: the
average absolute difference between the groups. At the alpha scale the
indices are averaged first before computing D_bar
.
Permutation tests are carried out for testing differences of the biodiversity
statistics among the groups (Legendre & Legendre 1998). This is accomplished
by using D_bar
as the test statistic and random shuffling the group
label across the samples. The p-value indicates how many of the permutations
result in a D_bar
as large as the observed D_bar
value.
A list of class mob_stats
that contains two objects:
1) comm_div
a data.frame of each diversity metrics for each group
at each scale specified, and
2) gorup_tests
a data.frame of the average difference between groups
in their diversity metric (D_bar
) with an associated p-value derived
from the permutation test.
Chao, A. 1984. Nonparametric Estimation of the Number of Classes in a Population. Scandinavian Journal of Statistics 11:265–270.
Chao, A. 1987. Estimating the population size for capture-recapture data with unequal catchability. Biometrics, 43, 783-791.
Gotelli, N. J., and R. K. Colwell. 2001. Quantifying biodiversity: procedures and pitfalls in the measurement and comparison of species richness. Ecology Letters 4:379–391.
Hurlbert, S. H. 1971. The nonconcept of species diversity: a critique and alternative parameters. Ecology 52:577–586.
Jost, L. 2007. Partitioning diversity into independent alpha and beta components. Ecology 88:2427–2439.
McGill, B. J. 2011. Species abundance distributions. Pages 105-122 Biological Diversity: Frontiers in Measurement and Assessment, eds. A.E. Magurran and B.J. McGill.
Whittaker, R. H. 1972. Evolution and measurement of species diversity. Taxon 21:213–251.
# tank community analysis
data(tank_comm)
data(tank_plot_attr)
tank_mob <- make_mob_in(tank_comm, tank_plot_attr)
tank_stats <- get_mob_stats(tank_mob, 'group', index = c('S', 'S_PIE', 'S_C'),
n_perm = 5, ci_n_boot = 5)
tank_stats
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.