| risk_matrix {NetworkRiskMeasures} | R Documentation | 
Computes the (binary) impact or vulnerability matrices
Description
The function computes an impact or vulnerability matrix given a network of bilateral exposures and a vector of capital buffers.
Usage
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")
)
Arguments
| 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  | 
Details
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.
Value
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.
Examples
# 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)