scr_moc: Margin of conservatism, by category

View source: R/pd.R

scr_mocR Documentation

Margin of conservatism, by category

Description

Appends entries to the MoC ledger of an scr_grades() object. Category "C" (general estimation error) is quantified: "ci_timeseries" takes the upper bound of a one-sided level interval of the long-run average from the cohort series, t_{q, T-1}\, sd(DR_t)/\sqrt{T} per grade; "ci_binomial" uses z_q \sqrt{PD(1-PD)/n} on the obligors (or obligor-years when a series exists); "bootstrap" resamples the outcomes of the sample within each grade (drawn as the resampled default rate, Binomial(n, DR) / n, its exact distribution) and takes the level quantile of the default rate above the estimate. Categories "A" (data and methodological deficiencies) and "B" (changes in standards or environment) are expert quantities: value (one number or one per grade, in PD units) and a non-empty reason are mandatory. The ledger is append-only: A and B entries accumulate, a new C supersedes the previous one (kept with active = FALSE).

Usage

scr_moc(
  x,
  category = c("A", "B", "C"),
  method = NULL,
  level = NULL,
  value = NULL,
  reason = NULL,
  dr = NULL,
  n_boot = 200L,
  seed = NULL
)

Arguments

x

An scr_grades() object.

category

"A", "B" or "C".

method

For "C": "ci_timeseries", "ci_binomial" or "bootstrap"; NULL reads config$pd_moc_method.

level

One-sided confidence level; NULL reads config$pd_moc_level.

value

For "A"/"B": the add-on in PD units, length 1 or one per grade.

reason

Justification (mandatory for "A"/"B").

dr

Optional scr_dr by grade for "ci_timeseries", keyed by the final grades of x; NULL uses the series already stored in x$dr by scr_grades().

n_boot, seed

Bootstrap resamples and seed for "bootstrap".

Value

The scr_grades object with the entries appended to moc.

See Also

Other irb-pd: predict.scr_grades(), predict.scr_pd(), scr_calibrate(), scr_grades(), scr_master_scale(), scr_migration(), scr_pd(), scr_pd_pit_ttc(), scr_pd_validate()

Examples

cfg <- scr_config(verbose = FALSE, nthread = 1, use_ranger = FALSE,
                  use_lightgbm = FALSE, xgb_rounds = 40, n_boot = 10)
res <- scr_select(scr_demo, "default", config = cfg, drop = c("id", "churn"),
                  date_col = "ref_date")
sc <- scr_scorecard(res)
gr <- scr_grades(sc, n_grades = 6, min_defaults = 10)
gr <- scr_moc(gr, "C", method = "ci_binomial")
gr <- scr_moc(gr, "A", value = 0.002, reason = "missing unlikeliness-to-pay trigger before 2024")
gr$moc

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