ps_rand | R Documentation |
This function compares phylodiversity metrics calculated in ps_diversity to their null distributions computed by randomizing the community matrix or shuffling the tips of the phylogeny, indicating statistical significance under the assumptions of the null model. Various null model algorithms are available for binary, probability, and count data.
ps_rand(
ps,
metric = "all",
fun = "quantize",
method = "curveball",
n_rand = 100,
spatial = TRUE,
n_cores = 1,
progress = interactive(),
...
)
ps |
|
metric |
Character vector giving one or more diversity metrics to calculate; see ps_diversity
for options. Can also specify |
fun |
Null model function to use. Must be either "tip_shuffle", "nullmodel", "quantize", or an actual function:
|
method |
One of the method options listed under commsim. If |
n_rand |
Integer giving the number of random communities to generate. |
spatial |
Logical: should the function return a spatial object (TRUE, default) or a matrix (FALSE). |
n_cores |
Integer giving the number of compute cores to use for parallel processing. |
progress |
Logical: should a progress bar be displayed? |
... |
Additional arguments passed to quantize, simulate.nullmodel, or custom function
|
A matrix with a row for every row of x
, a column for every metric specified in metric
, and
values indicating the proportion of randomizations in which the observed diversity metric was greater than
the randomized metric. Or if spatial = TRUE
, a sf
or SpatRaster
object containing these data.
ps_diversity()
# simulate a `phylospatial` data set and run randomization with default settings
ps <- ps_simulate(data_type = "prob")
rand <- ps_rand(ps)
# using the default `quantize` function, but with alternative arguments
rand <- ps_rand(ps, transform = sqrt, n_strata = 4, priority = "rows")
# using binary data
ps2 <- ps_simulate(data_type = "binary")
rand <- ps_rand(ps2, fun = "nullmodel", method = "r2")
# using abundance data, and demonstrating alternative metric choices
ps3 <- ps_simulate(data_type = "abund")
rand <- ps_rand(ps3, metric = c("ShPD", "SiPD"), fun = "nullmodel", method = "abuswap_c")
rand
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.