RarefyNetwork {cassandRa} | R Documentation |
Recalculate Network Metrics With Rarefied Webs
Description
Resamples empirical network observations at a range of sampling levels and calls networklevel() function from bipartite package to calculate network metrics.
Usage
RarefyNetwork(
web,
n_per_level = 1000,
frac_sample_levels = seq(0.2, 1, l = 5),
abs_sample_levels = NULL,
metrics = "info",
PARALLEL = FALSE,
cores = 2,
output = "df",
...
)
Arguments
web |
A matrix format web, as for |
n_per_level |
How many samples to take per sample level. Default is 1000. |
frac_sample_levels |
Sequence of fractions of original sample size to resample at. |
abs_sample_levels |
If supplied, vector of absolute sample sizes to use to override |
metrics |
vector of metrics to calculate. Will be passed to |
PARALLEL |
Logical. If TRUE, will use parallel package to speed up metric calculation. Default = FALSE |
cores |
If using parallel, how man cores to use. Default = 2 |
output |
String specifying output. If 'plot' will return a ggplot facetted by metric using |
... |
Additional arguments to pass to |
Details
Can return either a data frame of raw metrics, a ggplot or a data frame of 'confidence intervals'.
These CI are calculated from the set of resamples by ordering the network values and taking the value of the metric ranked at the 5th and 95th percentile. (this method is very similar to that employed by Casas et al. 2018 Assessing sampling sufficiency of network metrics using bootstrap Ecological Complexity 36:268-275.)
Note that confidence intervals for many metrics, particularly qualitative ones, will be biased by the issue of false-negatives. Resampling of observations will not introduce missing links.
By default the size of resamples are taken to be proportional to the original sample size. Original sample size is
defined as the sum of the supplied web. If a specific set of sample sizes is wanted, use abs_sample_levels
It is possible to extrapolate how increases sample size may lead to increased confidence in a metric too.
Set the sequence to frac_sample_levels
to go beyond 1.
Value
Either a dataframe or a ggplot object. See details.
See Also
Examples
data(Safariland, package = 'bipartite')
RarefyNetwork(Safariland, n_per_level = 100)