Compute the robustness of an ecological network by averaging over a great number of randomly generated primary extinctions sequences

robustness_emp(
  A,
  ext_seq = "uniform",
  nb_iter = 300,
  net_type = "bipartite",
  method = "ordered",
  power = 1,
  block = NULL
)

Arguments

A

A binary incident matrix

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 degree order sequence on the row species

nb_iter

An integer, the number of generated sequences. Default to 300.

net_type

A string, the type of network. For now, only "bipartite" is available.

method

A string used when ext_seq = "decreasing" or ext_seq = "increasing":

  • "linear" (default) set an extinction probability for each row species that is linear in its degree. It is a shortcut for method = "power" and power = 1.

  • "ordered" strictly follow the degree order, i.e. the most connected species will always goes last for ext_seq = "increasing" or first for ext_seq = "decreasing".

power

An integer (default to 1). Only used when method = "power", the power to which the degree are elevated to compute the primary extinctions sequences for "increasing" and "decreasing" ext_seq. For 1, it is equivalent to method = "linear", for 0, it is the same as ext_seq = "uniform". The largest the number the closest it will be to method = "ordered".

block

A vector of row species memberships for method = "block"

Value

A list (robber object) with the following fields:

  • $model, $ext_seq, $method, power

  • $fun is the robustness function, a vector of size (nrow(A) +1)

  • $sd Standard deviation of the secondary extinctions

  • $auc the area under the curve of the robustness function

Examples

A <- matrix(c(1, 0, 0,
             0, 1, 0,
             0, 0, 1,
             1, 1, 1), nrow = 4, ncol = 3, byrow = TRUE)
my_rob <- robustness_emp(A, ext_seq = "increasing")
my_rob$fun
#> [1] 1 1 1 1 0
my_rob$auc
#> [1] 1