scr_pd: The PD model: grades, margin of conservatism and the floor

View source: R/pd.R

scr_pdR Documentation

The PD model: grades, margin of conservatism and the floor

Description

Assembles the final grade table: pd_be from scr_grades(), the active entries of the MoC ledger by category (A and B summed over their entries, the latest C), pd_moc = pd_be + A + B + C, the PD floor of the asset class under the framework of params, and pd_final = max(pd_moc, floor). With philosophy = "pit" the through-the-cycle pd_moc is converted with the one-factor bridge of scr_pd_pit_ttc() before the floor (rho and z required).

Usage

scr_pd(
  grades,
  moc = NULL,
  params = NULL,
  asset_class = NULL,
  philosophy = c("ttc", "pit"),
  rho = NULL,
  z = NULL
)

Arguments

grades

An scr_grades() object, after scr_moc().

moc

NULL uses grades$moc; otherwise a ledger in the same format.

params

An scr_irb_params(); NULL uses config$framework.

asset_class

Asset class of the floor; NULL uses config$asset_class.

philosophy

"ttc" (default) or "pit".

rho, z

Asset correlation and systematic factor for "pit".

Value

An object of class scr_pd: table (grade, label, score_lo, score_hi, n, share, defaults, dr, pd_be, moc_a, moc_b, moc_c, pd_moc, pd_ttc, pd_pit, floor, pd_final, floor_applied), breaks, band_grade, direction, alignment, alignment_score, master_scale, asset_class, framework, floor, philosophy, rho, z, moc_ledger, calibration, concentration, portfolio (weighted pd_be, pd_moc, pd_final, moc_bp, share_at_floor), scorecard, ledger, model_card. Also params_modified, repairs, dr, rows, pd_source, grade_method, sample, target, config and, after scr_export(), files.

See Also

Other irb-pd: predict.scr_grades(), predict.scr_pd(), scr_calibrate(), scr_grades(), scr_master_scale(), scr_migration(), scr_moc(), 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_moc(scr_grades(sc, n_grades = 6, min_defaults = 10), "C", method = "ci_binomial")
pd <- scr_pd(gr)
pd
pd$table[, c("grade", "pd_be", "moc_c", "pd_final", "floor_applied")]
head(predict(pd, score = c(480, 560, 640), type = "pd_final"))
head(scr_apply(pd, head(scr_demo, 5)))
cat(tail(scr_sql(pd), 8), sep = "\n")

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