cfa | R Documentation |
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.
cfa(
...,
ordering = "tot",
custom.order = NULL,
decreasing = TRUE,
Rcpp = ifelse(requireNamespace("Rcpp", quietly = TRUE), yes = TRUE, no = FALSE)
)
... |
Firm-Firm network in one of the following classes:
|
ordering |
In what order to remove the firms, the completing ordering is always returned as part of the result. Take the following values:
|
custom.order |
Order in which to remove the firms. If |
decreasing |
Logical, defaults to
|
Rcpp |
Whether to use the |
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
Telarico, Fabio Ashtar
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")}.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.