predict.scr_pd: Predict grade and PD from an scr_pd object

View source: R/pd.R

predict.scr_pdR Documentation

Predict grade and PD from an scr_pd object

Description

Predict grade and PD from an scr_pd object

Usage

## S3 method for class 'scr_pd'
predict(
  object,
  newdata = NULL,
  score = NULL,
  type = c("grade", "pd", "pd_final", "score"),
  ...
)

Arguments

object

An scr_pd() object.

newdata

A table with the source columns of the scorecard, scored with scr_apply(); ignored when score is given.

score

Production scores, as an alternative to newdata.

type

"grade", "pd" (calibrated individual PD), "pd_final" (grade PD after MoC and floor) or "score".

...

Ignored.

Value

A vector of the length of the input.

See Also

Other irb-pd: predict.scr_grades(), scr_calibrate(), scr_grades(), scr_master_scale(), scr_migration(), scr_moc(), 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)
d <- scr_demo[, c("default", "ref_date", "ds_region", "ds_band", "vl_score_01",
                  "vl_score_02", "vl_score_05", "vl_score_10", "vl_hist_01")]
res <- scr_select(d, "default", config = cfg, date_col = "ref_date")
sc <- scr_scorecard(res)
pd <- scr_pd(scr_grades(sc, n_grades = 6, min_defaults = 10))
predict(pd, score = c(480, 560, 640), type = "pd_final")
head(predict(pd, newdata = scr_demo[1:10, ], type = "grade"))

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