boot_dissim: Bootstrap dissimilarity

View source: R/boot.r

boot_dissimR Documentation

Bootstrap dissimilarity

Description

Bootstrap dissimilarity between two vectors of interactions (or species names).

Usage

boot_dissim(lst_vect, index, by, replace, size_short, n_boot, n_cpu)

Arguments

lst_vect

A list with two character vectors of interactions.

index

The name of the desired index, e.g.: "whittaker", "jaccard", "sorensen". Character type.

by

Integer. Number of interactions used to increase gradually the sampled vectors of interactions until all observations are sampled. If by is too small (e.g. 1) then the computation time is very long depending on your total number of interactions from which samples are taken. As a rule of thum set by to maybe 5-10\% of your total interactions.

replace

Should sampling be with replacement? Passed to sample.

size_short

Should the total sample size be set by the length of the shortest vector from lst_vect? Logic type (TRUE or FALSE).

n_boot

Number of desired bootstraps (100 can be enough).

n_cpu

Number of CPU-s to use for parallel processing.

Value

A matrix of dissimilarities. The number of columns corresponds to n_boot (number of bootstraps). The names of the rows store the sample size of each sampled chunk. The final value corresponds to the length of the shortest vector (when size_short = TRUE), or to the length of the longest vector (when size_short = FALSE).

Examples


library(bootdissim)
library(bipartite)

net1 <- reshape_net(vazarr, seed = 1)
net2 <- reshape_net(vazcer, seed = 1)

vect <- get_interactions(net1, net2)

tst <- boot_dissim(lst_vect = vect,
                   index = "whittaker",
                   by = 50,
                   replace = TRUE,
                   size_short = FALSE,
                   n_boot = 10,
                   n_cpu = 2)


valentinitnelav/bootdissim documentation built on Oct. 11, 2022, 12:34 a.m.