robustness_lbm {robber}R Documentation

Robustness for LBM

Description

Compute the robustness for a given set of Latent Block Model parameters.

Usage

robustness_lbm(
  con = NULL,
  pi = NULL,
  rho = NULL,
  nr = NULL,
  nc = NULL,
  ext_seq = "uniform",
  method = "exact",
  approx_threshold = 10000,
  net = NULL,
  ...
)

Arguments

con

A matrix, the connectivity parameter

pi

A vector of length nrow(con), the proportion of row blocks

rho

A vector of length ncol(con), the proportion of column blocks

nr

An integer, the number of row (primary) species

nc

An integer, the number of column (secondary) species

ext_seq

A string, the rule for the primary extinctions sequences, one of:

  • "uniform", the default for uniform extinctions sequences,

  • "decreasing" and "increasing" for primary extinctions sequences by increasing and decreasing row blocks connection probability,

  • "natural" primary extinctions sequences with the block ordering given in the function parameter.

  • "blocks" primary extinctions sequences for all blocks permutation.

method

A string, the method used to compute the robustness by block. One of:

  • "exact" (the default), average on all possible networks

  • "no_empty_block" restricts the networks space to the ones with no empty block of primary species

  • "expected" restricts the networks space to the ones that have approximately the same number of species per block than the expected one. Do not do anything for ext_seq = "uniform".

approx_threshold

A numeric, the maximum size of the possible block partition allowed for exact robustness by block calculation. Higher threshold gives more precise results at the cost of computation times and possibly memory problem. Do not do anything for ext_seq = "uniform". When the threshold is exceeded the robustness is computed by a Monte Carlo approximation with approx_threshold number of samples.

net

A network, if given, the function will fit a LBM to obtain the parameters of the network and then compute the robustness.

...

Option to be passed to get_lbm_param function.

Value

A list and a robber type object:

Examples

con <- matrix(c(.5,.3,.3,.1), 2, 2)
pi  <- c(.25,.75)
rho <- c(1/3, 2/3)
nr <- 50
nc <- 30
my_rob <- robustness_lbm(con, pi, rho, nr, nc, ext_seq = "natural")
my_rob$fun
my_rob$auc
# A easier alternative way, if you don't know the parameters of the network:
data(hostparasite)
(robustness_lbm(net = hostparasite, ncores = 1L))

[Package robber version 0.2.4 Index]