[−][src]Function loan_ec::risk_contribution
pub fn risk_contribution(
loan: &Loan,
el_vec: &[f64],
el_sys: &[f64],
var_vec: &[f64],
var_sys: &[f64],
lambda0: f64,
lambda: f64,
q: f64,
c: f64
) -> f64
Returns risk contribution for a given loan. This function is used by experiment_risk_contribution but can also be used on its own.
Arguments
loan
- An instance of the Loan structel_vec
- The portfolio vector of expected loss. Has the same size as the weight vector in the Loan struct.el_sys
- The vector of expected values for the systemic random variables. This is typically a vector of ones.var_vec
- The portfolio vector of variance. Has the same size as the weight vector in the Loan struct.var_sys
- The vector of variances for the systemic random variables.lambda0
- Base loss (in dollars) from a liquidity event. A positive number.lambda
- Sum of r*balance over each loan in the portfolio.q
- Probability of liquidity event (scaled by the total portfolio loss).c
- Scalar for multiplying the covariance for the risk contribution when using the variance risk measure. Typically (rho(X)-E[X])/sqrt(Var(X)) where rho is the value of the portfolio risk measure (eg, VaR).