Description Usage Arguments Value References Examples
View source: R/matrix_estimation.R
Methods for estimating matrix entries from the marginals (row and column sums).
There are currently two methods implemented: Maximum Entropy (Upper 2004) and Minimum Density (Anand et al. 2015).
You may use the matrix_estimation()
function, setting the desired method
.
Or you may use directly the max_ent()
function for maximum entropy estimation
or the min_dens()
function for minimum density estimation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | matrix_estimation(
rowsums,
colsums,
method = c("me", "md"),
...,
max.it = 1e+05,
abs.tol = 0.001,
verbose = TRUE
)
max_ent(rowsums, colsums, max.it = 1e+05, abs.tol = 0.001, verbose = TRUE)
min_dens(
rowsums,
colsums,
c = 1,
lambda = 1,
k = 100,
alpha = 1/sum(rowsums),
delta = 1/sum(rowsums),
theta = 1,
remove.prob = 0.01,
max.it = 1e+05,
abs.tol = 0.001,
verbose = TRUE
)
|
rowsums |
a numeric vector with the row sums. |
colsums |
a numeric vector with the column sums. |
method |
the matrix estimation method. Choose |
... |
further arguments passed to or from other methods. |
max.it |
the maximum number of iterations. |
abs.tol |
the desired accuracy. |
verbose |
gives verbose output. Default is |
c |
the 'cost' an extra link for the minimum density estimation. See Anand et al. (2015). |
lambda |
you should use |
k |
you should use |
alpha |
weights for the row sums deviations. See Anand et al. (2015). |
delta |
weights for the column sums deviations. See Anand et al. (2015). |
theta |
scaling parameter. Emphasizes the weight placed on finding solutions with similar characteristics to the prior matrix. See Anand et al. (2015). |
remove.prob |
probability to randomly remove a link during the algorithm. See Anand et al. (2015). |
The functions return the estimated matrix.
Upper, C. and A. Worm (2004). Estimating bilateral exposures in the German interbank market: Is there a danger of contagion? European Economic Review 48, 827-849.
Anand, K., Craig, B. and G. von Peter (2015). Filling in the blanks: network structure and interbank contagion. Quantitative Finance 15:4, 625-636.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Example from Anand, Craig and Von Peter (2015, p.628)
# Liabilities
L <- c(a = 4, b = 5, c = 5, d = 0, e = 0, f = 2, g = 4)
# Assets
A <- c(a = 7, b = 5, c = 3, d = 1, e = 3, f = 0, g = 1)
# Maximum Entropy
ME <- matrix_estimation(A, L, method = "me")
ME <- round(ME, 2)
# Minimum Density
set.seed(192)
MD <- matrix_estimation(A, L, method = "md")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.