scr_default: Build the default flag from a monthly panel

View source: R/default.R

scr_defaultR Documentation

Build the default flag from a monthly panel

Description

Applies the standard definition of default to a panel with one row per unit (id) and month (date): a unit enters default when dpd reaches default_days and the arrears are material (both default_abs in currency units and default_rel as a share of exposure, when arrears and exposure are supplied), or when utp (unlikeliness to pay) is TRUE. It leaves default after default_probation consecutive months without a trigger (default_probation_restructured when restructured was TRUE at any point of the event). With obligor supplied and default_level = "obligor", a unit whose obligor has more than default_pulling of its exposure in default is pulled into default too, and a defaulted obligor defaults all its units.

Usage

scr_default(
  data,
  id,
  date,
  dpd = NULL,
  arrears = NULL,
  exposure = NULL,
  utp = NULL,
  restructured = NULL,
  obligor = NULL,
  config = scr_config()
)

Arguments

data

A data.frame or data.table, one row per id and date.

id, date

Column names of the unit identifier and the month.

dpd

Column name of days past due (integer). Optional when utp is given.

arrears, exposure

Column names of the overdue amount and the total exposure, both optional; when given, the materiality test applies.

utp

Column name of a logical unlikeliness-to-pay flag, optional.

restructured

Column name of a logical distressed-restructuring flag, optional.

obligor

Column name of the obligor when id is a facility, optional; enables the pulling effect.

config

A scr_config(); keys ⁠default_*⁠.

Details

Rows must be monthly; gaps are tolerated (the probation counts observed months). The result keeps the row-level flags: they are the product.

Value

An object of class scr_default: flags (id, date, default 0/1, event_id, trigger, months_in_default, cured), events (one row per event: event_id, id, start, end, trigger, cured, months), summary, ledger and config.

See Also

Other irb-parameters: scr_default_rate(), scr_irb_params()

Examples

d <- scr_default(scr_demo_panel, id = "id", date = "ref_date", dpd = "dpd",
                 arrears = "arrears", exposure = "exposure",
                 restructured = "restructured",
                 config = scr_config(verbose = FALSE))
d
head(d$events)

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