scr_ecl: Expected credit loss with stage allocation

View source: R/ecl.R

scr_eclR Documentation

Expected credit loss with stage allocation

Description

Discrete-time expected credit loss of every exposure:

Usage

scr_ecl(
  pd_term,
  lgd,
  ead,
  eir = 0,
  stage = NULL,
  dpd = NULL,
  pd_orig = NULL,
  scenarios = NULL,
  weights = NULL,
  prepay = NULL,
  rho = 0.15,
  t_max = NULL,
  segment = NULL,
  id = NULL,
  config = scr_config(),
  keep_rows = FALSE
)

Arguments

pd_term

Marginal monthly PDs: a matrix ⁠n x T⁠, or a vector of length n (a flat hazard recycled over t_max months), or a single number.

lgd, ead

Vectors of length n (or one) or matrices ⁠n x T⁠.

eir

Annual effective interest rate, vector of length n or one.

stage

Optional stage vector (1, 2, 3); NULL applies the rule.

dpd

Days past due (the rule); optional.

pd_orig

12-month PD at origination (the rule); optional.

scenarios

Named list of scenario shocks (see Details); NULL runs the base case only.

weights

Scenario weights; equal when NULL.

prepay

Monthly prepayment hazard: NULL, a vector or an ⁠n x T⁠ matrix.

rho

Asset correlation used by scenario shocks with z.

t_max

Term in months when pd_term is a vector (default config$ecl_horizon_months).

segment

Optional character vector of length n for a segment summary.

id

Optional identifier vector of length n.

config

An scr_config() object (⁠ecl_*⁠ keys, verbose).

keep_rows

Keep the per-exposure table.

Details

ECL_H = \sum_{t=1}^{H} S(t-1)\, h_t\, LGD_t\, EAD_t\, (1+r)^{-t/12}, \qquad S(t) = \prod_{s \le t}(1 - h_s - p_s)

with h_t the marginal monthly default hazard, p_t an optional prepayment hazard and r the annual effective interest rate (config$ecl_discount = "none" switches the discounting off). The 12-month figure uses H = config$ecl_horizon_months, the lifetime figure the full term T. Stage 1 exposures carry the 12-month loss, stages 2 and 3 the lifetime loss; stage 3 exposures are credit-impaired and carry LGD_1 * EAD_1. When stage is NULL the rule is: stage 3 if dpd >= config$ecl_stage_dpd[2], stage 2 if dpd >= config$ecl_stage_dpd[1] or the 12-month PD now over the one at origination (pd_orig) is at least config$ecl_sicr_ratio, else stage 1.

Scenarios are a named list of shocks applied to the base inputs, each a list with any of pd_mult (non-negative multiplier of the hazards, capped at one), z (systematic factor of the one-factor model applied to the hazards with correlation rho, negative in a bad year), lgd_add (added to the LGD, the result floored at zero) and ead_mult (non-negative); weights (normalized to one) give the probability-weighted result. When a shocked hazard plus the prepayment hazard exceeds one, the exit probability of that month is capped at one. The z shock is applied to each monthly hazard, not to the annual PD; because the Vasicek map is non-linear, the implied 12-month stressed PD is higher than the one obtained by stressing the annual PD with the same z and rho (convert the annual PD yourself when that is wanted).

Value

An object of class scr_ecl: a list with exposures (only with keep_rows = TRUE: id, segment, stage, ead, pd_12m, pd_life, ecl_12m, ecl_life, ecl), stages (stage, n, ead, ecl_12m, ecl_life, ecl, coverage), segments (when a segment is given), scenarios (scenario, weight, ecl_12m, ecl_life, ecl), totals (n, ead, ecl_12m, ecl_life, ecl, coverage, share_stage2, share_stage3), horizon, t_max, discount, stage_rule, ledger and config.

References

International Accounting Standards Board (2014). IFRS 9 Financial Instruments, section 5.5 and paragraphs B5.5.1-B5.5.55.

See Also

Other irb-capital: scr_capital(), scr_el(), scr_irb_rw(), scr_pd_stress(), scr_sa_rw()

Examples

cfg <- scr_config(verbose = FALSE)
d <- scr_demo_portfolio
h <- 1 - (1 - d$pd)^(1 / 12)       # flat monthly hazard from the annual PD
e <- scr_ecl(h, d$lgd, d$ead, eir = d$eir, dpd = d$dpd, pd_orig = d$pd_orig,
             t_max = 36L, segment = d$segment, config = cfg)
e
e$stages

scorecraft documentation built on Dec. 6, 2026, 1:09 a.m.