cfa: Perform cascade failure analysis

View source: R/06.3.cfa.R

cfaR Documentation

Perform cascade failure analysis

Description

Cascade failure analysis (CFA) involves understanding how failures in one part of the network might cascade to other parts. Networks capable of isolating such failures or minimizing their effects demonstrate higher robustness.

Usage

cfa(
  ...,
  ordering = "tot",
  custom.order = NULL,
  decreasing = TRUE,
  Rcpp = ifelse(requireNamespace("Rcpp", quietly = TRUE), yes = TRUE, no = FALSE)
)

Arguments

...

Firm-Firm network in one of the following classes:

  • financial_matrix produced by FF and family;

  • network_financial or network if the relevant package is installed;

  • igraph_financial or igraph if the relevant package is installed.

ordering

In what order to remove the firms, the completing ordering is always returned as part of the result. Take the following values:

  • random - Random order, corresponds to percolation theory

  • out - By out-degree

  • in - By in-degree

  • tot - By sum of in- and out-degre (default)

  • custom - Customised ordering via custom.order

custom.order

Order in which to remove the firms. If ordering is not 'custom', it is ignored. Defaults to NULL.

decreasing

Logical, defaults to TRUE. Only evaluated if ordering is neither 'custom' nor 'random'.

  • if TRUE - the ordering is by decreasing degree and higher in-/out-/total-degree firms are removed first

  • if FALSE - the ordering is by increasing degree and higher in-/out-/total-degree firms are removed last

Rcpp

Whether to use the C++ or native-R version of the search algorithm. Defaults to TRUE if the package Rcpp is installed.

Value

A data.frame with one row for the result of the CFA after each node is removed. The columns report:

  • l_scc - Size of the largest strongly connected component

  • rem_id - ID of the firm removed

  • rem_pos - Position of the firm removed (row/column number)

  • n_scc - Number of strongly connected components

  • n_rem - Number of firms removed

  • n_left - Number of firms left

Author(s)

Telarico, Fabio Ashtar

References

Elliott, Matthew, Benjamin Golub, and Matthew O. Jackson. ‘Financial Networks and Contagion’. American Economic Review 104, no. 10 (1 October 2014): 3115–53. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1257/aer.104.10.3115")}.

Examples

# Create a matrix
mat <- matrix(c(
    0, 1, 0, 1, 0, 1, 0, 0,
    0, 0, 1, 0, 0, 0, 0, 0,
    1, 0, 0, 0, 0, 0, 0, 0,
    0, 1, 1, 0, 1, 0, 0, 0,
    0, 0, 0, 1, 0, 1, 0, 0,
    0, 0, 1, 0, 0, 0, 1, 0,
   0, 0, 0, 0, 0, 1, 0, 0,
    0, 0, 0, 0, 1, 0, 1, 1
  ),ncol = 8, byrow = TRUE)
# Add rownames
rownames(mat) <- paste0("Firm", LETTERS[1:ncol(mat)])

# Create a FF matrix
mat <- methods::new('financial_matrix',
                    M = mat,
                    relation = c('own'),
                    legal_form = c('JSC'),
                    sector = c('A.01'),
                    revenues = c(NA),
                    capitalisation = c(NA),
                    currency = c('USD'))

# Notice the differnce between:
# a. CFA with ordering by in-degree (decreasing)
# b. CFA with ordering by in-degree (increasing)
cfa(mat, ordering = 'in', decreasing = FALSE)
# But ordering by increasing (decreasing) in-degree is the
# same as ordering by decreasing (increasing) out-degree and
# vice versa!
cfa(mat, ordering = 'out', decreasing = FALSE) # By out-degree (increasing)


FinNet documentation built on Oct. 31, 2024, 5:07 p.m.