Package: scorecraft 0.3.2

scorecraft: Scorecard Development and Internal Ratings-Based Risk Parameters

Builds points scorecards for binary targets (credit risk, fraud, propensity) on the optimal binning and weight of evidence engine of 'OptimalBinningWoE', and takes them to the risk parameters of the internal ratings-based (IRB) approach. Variables are selected through optimal binning, eight admission rules, hold-out revalidation with frozen bins and a consensus of 'glmnet', 'xgboost', 'lightgbm' and 'ranger' models weighted by out-of-sample performance; the audit funnel never drops a candidate from the report. The scorecard is fitted with an explicit, auditable scale alignment (a log-odds regression on the raw score composed with the points-to-double-the-odds map); cut-offs are swept with frozen cuts; reject inference is reported as a sensitivity band; the population and characteristic stability indices (PSI and CSI) are monitored with both the fixed and the sample-size-adjusted threshold; and production SQL is generated in fourteen dialects, with the agreement between R and SQL verified by test. The IRB layer builds the default flag; calibrates the scorecard to a long-run default rate with rating grades, margins of conservatism and floors to give the probability of default (PD); models workout loss given default (LGD) in two stages with downturn and in-default estimates; models credit conversion factors from facility snapshots to give the exposure at default (EAD); and computes expected loss, risk weights, regulatory capital and expected credit loss from parameter tables selected by framework preset. The heavy numeric kernels (rank correlation of wide weight of evidence tables, exact concordance counts for Somers' D, streamed expected credit loss paths) are compiled with 'RcppArmadillo'. The scorecard methodology follows Siddiqi (2017) <doi:10.1002/9781119282396> and Thomas et al. (2017) <doi:10.1137/1.9781611974560>.

Authors:Jose Evandeilton Lopes [aut, cre, cph]

scorecraft_0.3.2.tar.gz
scorecraft_0.3.2.zip(r-4.7-x86_64)scorecraft_0.3.2.zip(r-4.7-arm64)scorecraft_0.3.2.zip(r-4.6-x86_64)scorecraft_0.3.2.zip(r-4.6-arm64)scorecraft_0.3.2.zip(r-4.5-x86_64)
scorecraft_0.3.2.tgz(r-4.6-x86_64)scorecraft_0.3.2.tgz(r-4.6-arm64)scorecraft_0.3.2.tgz(r-4.5-x86_64)scorecraft_0.3.2.tgz(r-4.5-arm64)
scorecraft_0.3.2.tar.gz(r-4.7-arm64)scorecraft_0.3.2.tar.gz(r-4.7-x86_64)scorecraft_0.3.2.tar.gz(r-4.6-arm64)scorecraft_0.3.2.tar.gz(r-4.6-x86_64)
scorecraft_0.3.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
scorecraft/json (API)

# Install 'scorecraft' in R:
install.packages('scorecraft', repos = c('https://evandeilton.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/evandeilton/scorecraft/issues

Pkgdown/docs site:https://evandeilton.github.io

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:

On CRAN:

Conda:

openblascppopenmp

4.90 score 265 downloads 87 exports 70 dependencies

Last updated from:3906bceb52. Checks:13 OK, 2 ERROR. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK339
linux-devel-x86_64OK310
source / vignettesOK299
linux-release-arm64OK338
linux-release-x86_64OK397
macos-release-arm64OK349
macos-release-x86_64OK592
macos-oldrel-arm64OK405
macos-oldrel-x86_64OK1062
windows-devel-arm64ERROR515
windows-devel-x86_64OK335
windows-release-arm64ERROR515
windows-release-x86_64OK279
windows-oldrel-x86_64OK489
wasm-releaseOK141

Exports:scr_alignscr_applyscr_bandsscr_binscr_bin_continuousscr_calibratescr_capitalscr_claimsscr_classing_acceptscr_classing_applyscr_classing_choosescr_classing_discardscr_classing_importscr_classing_proposescr_classing_readscr_classing_specscr_classing_viewscr_coarse_classingscr_comparescr_configscr_config_keysscr_connectscr_corescr_cutoffscr_decisionsscr_defaultscr_default_ratescr_detectionscr_eadscr_ead_datascr_ead_downturnscr_ead_validatescr_eclscr_elscr_elbescr_exportscr_fetchscr_funnelscr_gainsscr_gradesscr_irb_paramsscr_irb_rwscr_ivscr_leakagescr_lgdscr_lgd_downturnscr_lgd_floorscr_lgd_poolsscr_lgd_validatescr_master_scalescr_maturityscr_metricsscr_migrationscr_mix_shiftscr_mocscr_modelscr_monitorscr_monitoring_planscr_operatingscr_overlapscr_pdscr_pd_pit_ttcscr_pd_stressscr_pd_validatescr_presetsscr_psiscr_ragscr_rag_planscr_reasonsscr_rejectscr_runscr_sa_rwscr_score_crossscr_score_gainsscr_score_metricsscr_scorecardscr_segmentsscr_selectscr_selectedscr_splitscr_sqlscr_strategyscr_tiersscr_triagescr_upliftscr_verbosescr_workout

Dependencies:classcliclockcodetoolscpp11data.tablediagramdialsDiceDesigndigestdplyrfarverfuturefuture.applygenericsggplot2globalsgluegowergtablehardhatipredisobandjsonliteKernSmoothlabelinglatticelavalifecyclelistenvlubridatemagrittrMASSMatrixnnetnumDerivOptimalBinningWoEparallellypillarpkgconfigprodlimprogressrpurrrR6RColorBrewerRcppRcppArmadillorecipesrlangrpartS7scalessfdshapesparsevctrsSQUAREMstringistringrsurvivaltibbletidyrtidyselecttimechangetimeDatetzdbutf8vctrsviridisLitewithrxgboost

Score studies
1. Three scores on the demo data | 2. Credit: bands, tiers and lights | 3. Fraud: tail bands, action tiers and a daily capacity | 4. Churn: anchored tiers, claims and a budget | 5. Credit and churn on the same customers | 6. Why the default rate moved | 7. One score, many segments | 8. Time, treatment, rules and episodes | 9. Production

Last update: 2026-10-01
Started: 2026-10-01

Coarse classing with an audit trail
Why manual coarse classing still matters | A fast selection run | Opening the lab | Proposing bins | Numeric: breaks, merge, split | Categorical: groups, other_to, missing_to | Reading the warnings and the verdict | Accepting, discarding and the blocked path | Choosing the variables | The session summary and the ledger | The spec round trip: a reviewer edits in a spreadsheet | Committing the lab: what changed | Refitting the scorecard | Production: R and SQL follow the manual bins | Governance

Last update: 2026-10-01
Started: 2026-09-04

Scaling, alignment and challengers
1. Why "700 points" means nothing on its own | The scale is one statement | The orientation trap | 2. The two-step regression alignment | 3. Two targets, two conventions, one scale | 4. From logit to points | 5. Do the odds double every PDO? | 6. A tree challenger on the same scale | The swap set | 7. The portfolio view | 8. Rescaling an existing scorecard | 9. A checklist for the model committee | Reference

Last update: 2026-10-01
Started: 2026-09-04

scorecraft: from raw table to production SQL and monitoring
1. Configuration | 2. Selection and the funnel | 3. The scorecard | 4. Cut-off and strategy | The sweep | The strategy table | 5. Reject inference | 6. Scoring and reasons | 7. Production SQL | 8. Monitoring | The monitoring plan | 9. Deliverables | 10. Before go-live | Appendix: from a database | Next steps | References

Last update: 2026-10-01
Started: 2026-09-04

Readme and manuals

Help Manual

Help pageTopics
Apply an alignment to raw scorespredict.scr_align
Grade a score vector with the cut points of an scr_grades objectpredict.scr_grades
Predict grade and PD from an scr_pd objectpredict.scr_pd
Stage 5: align a raw score to the declared scalescr_align
Apply the WOE transformation or the scorecard to new datascr_apply scr_apply.scr_ead scr_apply.scr_lgd scr_apply.scr_pd scr_apply.scr_result scr_apply.scr_scorecard scr_apply.scr_study
Percentile study of a scorescr_bands scr_bands.data.frame scr_bands.scr_scorecard
Stage 2: optimal binning, screening, hold-out revalidation and pruningscr_bin
Bin drivers against a continuous target (LGD, CCF)scr_bin_continuous
Calibrate the alignment to a central tendencyscr_calibrate
Expected loss, risk-weighted assets and capital of a portfolioscr_capital
Probability statements about the event rate of score groupsscr_claims scr_claims.data.frame scr_claims.scr_scorecard scr_claims.scr_study
Accept or discard a proposalscr_classing_accept scr_classing_discard
Commit the lab into a new selection resultscr_classing_apply
Choose the final variable list manuallyscr_classing_choose
Propose manual bins for a variablescr_classing_propose
Classing specification as a long table, with its file round tripscr_classing_import scr_classing_read scr_classing_spec
Inspect the current bins of a variable in the labscr_classing_view
Coarse classing lab: manual binning and manual variable choicescr_coarse_classing
Compare runs across targetsscr_compare
Pipeline configurationscr_config
Dictionary of configuration keysscr_config_keys
Connect to a database (ODBC DSN or any DBI driver)scr_connect
Variables that cross several targetsscr_core
Stage 6: cut-off sweep with frozen cutsscr_cutoff
Decision ledger of a lab, a result or a scorecardscr_decisions
Build the default flag from a monthly panelscr_default
One-year default rates by cohort and the long-run averagescr_default_rate
Synthetic example datascr_demo
Synthetic monthly facility snapshots for the EAD/CCF modulescr_demo_ead
Synthetic default events for the workout LGD examplesscr_demo_lgd
Synthetic post-default cash flows of 'scr_demo_lgd'scr_demo_lgd_cashflows
Synthetic monthly panel for the default engine and PD calibrationscr_demo_panel
Synthetic exposure snapshot for expected loss, capital and ECLscr_demo_portfolio
Synthetic monthly reference rate seriesscr_demo_rates
Time to detection of fraud episodesscr_detection scr_detection.data.frame
Estimate CCF pools from the reference data setscr_ead
Build the realized-CCF reference data set from facility snapshotsscr_ead_data
Downturn CCF per poolscr_ead_downturn
Validate CCF pools: calibration, discrimination, back-testing and stabilityscr_ead_validate
Expected credit loss with stage allocationscr_ecl
Expected loss per exposurescr_el
ELBE and in-default LGD on a grid of months since defaultscr_elbe
Write the deliverablesscr_export scr_export.scr_capital scr_export.scr_claims scr_export.scr_classing scr_export.scr_detection scr_export.scr_ead scr_export.scr_lgd scr_export.scr_maturity scr_export.scr_mix_shift scr_export.scr_operating scr_export.scr_overlap scr_export.scr_pd scr_export.scr_rag scr_export.scr_result scr_export.scr_scorecard scr_export.scr_score_cross scr_export.scr_segments scr_export.scr_study scr_export.scr_uplift
Fetch a table with reproducible server-side samplingscr_fetch
Audit funnel: every input variable and its fatescr_funnel
Gains table, at bin levelscr_gains
Rating grades on the scorescr_grades
IRB parameter tables by framework presetscr_irb_params
IRB risk weight of one or many exposuresscr_irb_rw
Information Value of any groupingscr_iv
Leakage and suspicious-strength auditscr_leakage
Two-stage LGD model and pools on the reference data setscr_lgd
Downturn LGD per poolscr_lgd_downturn
Input floor on the downturn LGD per poolscr_lgd_floor
LGD pools from the predicted LGDscr_lgd_pools
Validation battery of an LGD modelscr_lgd_validate
Master scale of PD gradesscr_master_scale
Maturity of the event by score bandscr_maturity scr_maturity.data.frame
AUC, KS and Gini of a score, with a bootstrap confidence intervalscr_metrics
Migration matrix between two rating datesscr_migration
Mix and rate effects of a change in the event ratescr_mix_shift scr_mix_shift.data.frame scr_mix_shift.scr_scorecard scr_mix_shift.scr_study
Margin of conservatism, by categoryscr_moc
Stages 3 and 4: multi-strategy selection and consensusscr_model
Monitor the scorecard on new datascr_monitor
Monitoring plan read by scr_monitor()scr_monitoring_plan
Operating point of a score under constraintsscr_operating scr_operating.data.frame scr_operating.scr_scorecard
Overlap of rules and a scorescr_overlap scr_overlap.data.frame
The PD model: grades, margin of conservatism and the floorscr_pd
One-factor bridge between point-in-time and through-the-cycle PDscr_pd_pit_ttc
Stressed PD of the one-factor modelscr_pd_stress
Validate a PD model on a cohort panelscr_pd_validate
Selection presets, side by sidescr_presets
Population stability index, with the fixed and the sample-size-adjusted thresholdscr_psi
Red / amber / green lights of a score against its referencescr_rag scr_rag.data.frame scr_rag.scr_scorecard scr_rag.scr_study
Thresholds of the red / amber / green lightsscr_rag_plan
Reason codes: the variables that took the most points from each rowscr_reasons
Stage 6: honest reject inference through a sensitivity bandscr_reject
Result of a selectionas.data.frame.scr_result plot.scr_result print.scr_result scr_result summary.scr_result
Run the selection for several targets straight from the databasescr_run
Set of runs, one per targetprint.scr_runset scr_runset
Standardized risk weight of an exposurescr_sa_rw
Two scores on the same rowsscr_score_cross scr_score_cross.data.frame
Score gains per frozen bandscr_score_gains
Score metrics per sample, with CIscr_score_metrics
Stages 4 and 5: points scorecard, aligned to the declared scalescr_scorecard
One score on many segmentsscr_segments scr_segments.data.frame scr_segments.scr_scorecard
Select variables for the scorecardscr_select
Variables approved for the scorecardscr_selected
Stage 0: type the data and split train and hold-outscr_split
Production SQLscr_sql scr_sql.scr_capital scr_sql.scr_ead scr_sql.scr_lgd scr_sql.scr_pd scr_sql.scr_result scr_sql.scr_scorecard scr_sql.scr_study
Stage 6: strategy table per band, with marginal expected profitscr_strategy
Tiers of a score: a few labeled levels of risk or propensityscr_tiers scr_tiers.data.frame scr_tiers.scr_scorecard
Stage 1: descriptive triage and sentinel resolutionscr_triage
Uplift of a treatment along a scorescr_uplift scr_uplift.data.frame
Switch progress messages on or offscr_verbose
Workout LGD: the reference data set from default events and cash flowsscr_workout