diversity_boot(tab, n, n.boot = 1L, n.rare = NULL, H = TRUE, G = TRUE,
lambda = TRUE, E5 = TRUE, ...)
mlg.table
. MLGs in columns and populations in rowsR
in the function boot
.n.boot
< 2 (default), the number of samples
drawn for each bootstrap replicate will be equal to the number of samples in
the data set.NULL
, indicating that each population will be sampled at its own
size.boot
and
diversity_stats
.n.rare
is a number greater than zero, then bootstrapping
is performed by randomly sampling without replacementn.raresamples from the data.n.boot
is greater than 1, bootstrapping is performed by
sampling n.boot samples from a multinomial distribution weighted by the
proportion of each MLG in the data.n.boot
is less than 2, bootstrapping is performed by
sampling N samples from a multinomial distribution weighted by the
proportion of each MLG in the data.n.boot
. Both
of these methods should be taken with caution in interpretation. There
are several R packages freely available that will calculate and perform
bootstrap estimates of Shannon and Simpson diversity metrics (eg.
diversity_stats
for basic statistic calculation,
diversity_ci
for confidence intervals and plotting, and
poppr
. For bootstrap sampling:
rmultinom
boot
library(poppr)
data(Pinf)
tab <- mlg.table(Pinf, plot = FALSE)
diversity_boot(tab, 10L)
# This can be done in a parallel fashion (OSX uses "multicore", Windows uses "snow")
system.time(diversity_boot(tab, 10000L, parallel = "multicore", ncpus = 4L))
system.time(diversity_boot(tab, 10000L))
Run the code above in your browser using DataLab