Description Usage Arguments Details Value Examples

View source: R/risk_matrices.R

The function computes an impact or vulnerability matrix given a network of bilateral exposures and a vector of capital buffers.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
risk_matrix(
exposures,
buffer,
binary = FALSE,
exposure_type = c("assets", "liabilities", "impact", "vulnerability"),
returns = c("impact", "vulnerability")
)
vulnerability_matrix(
exposures,
buffer,
binary = FALSE,
exposure_type = c("assets", "liabilities", "impact", "vulnerability")
)
impact_matrix(
exposures,
buffer,
binary = FALSE,
exposure_type = c("assets", "liabilities", "impact", "vulnerability")
)
``` |

`exposures` |
an adjacency |

`buffer` |
a numeric vector with the capital buffer for each vertex.
Values should be in the same row/column order as the network of bilateral exposures. The
buffer is not needed if |

`binary` |
if |

`exposure_type` |
character vector indicating the type of the bilateral exposures. It can be
an |

`returns` |
will the function return the impact or the vulnerability matrix?
The default is |

The impact matrix represents how much a vertex impacts the capital buffer of another vertex when it defaults.

The vulnerability matrix is just the transpose of the impact matrix. It represents how much a vertex is impacted by the default of another vertex.

The function returns a (binary) impact or vulnerability matrix.

The term V[i,j] of the impact matrix represents the impact of i's default in j's capital buffer.

The term V[i,j] of the vulnerability matrix represents how much i's capital buffer is impacted by j's default.

If `binary = TRUE`

the values less than 1 are truncated to zero.

1 2 3 4 5 6 7 8 9 10 11 | ```
# Creating example data
## Assets Matrix (bilateral exposures)
assets_matrix <- matrix(c(0, 10, 3, 1, 0, 2, 0, 3, 0), ncol = 3)
rownames(assets_matrix) <- colnames(assets_matrix) <- letters[1:3]
## Capital Buffer
buffer <- c(a = 2, b = 5, c = 2)
# Vulnerability matrices
vulnerability_matrix(assets_matrix, buffer, binary = FALSE)
vulnerability_matrix(assets_matrix, buffer, binary = TRUE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.