Prepayment as a competing risk in consumer-credit PD term structures (Prosper marketplace lending)
Description
Analysis-ready data and Python code that reproduce all tables and figures of the article "Prepayment as a Competing Risk in Consumer-Credit PD Term Structures: Evidence from Marketplace Lending" (Journal of Risk and Financial Management). Loan default and voluntary prepayment are modelled as competing risks on the public Prosper marketplace-lending portfolio (n = 113,932 loans, origination vintages 2005-2014). The scripts reproduce the probability-of-default (PD) term structure, the Kaplan-Meier-vs-competing-risks bias, cause-specific Cox and Fine-Gray subdistribution models, out-of-sample validation (integrated Brier score, time-dependent AUC, calibration), crisis-vintage and calendar stress tests, and the discounted expected-credit-loss over-provisioning. Run code/prosper_prep.py (optional, rebuilds the derived data from the raw Kaggle file) then code/jrfm_reproduce.py. All randomness is seeded.
Files
Steps to reproduce
Requirements: Python 3.10+ with numpy, pandas, lifelines, scikit-survival, statsmodels, matplotlib (see requirements.txt). Install with: pip install -r requirements.txt Step 1 (optional - the analysis-ready file data/prosper_cr2.csv is already included). To rebuild it from the raw source, download "Prosper Loan Data" (prosperLoanData.csv) from Kaggle, then run: python code/prosper_prep.py path/to/prosperLoanData.csv This writes data/prosper_cr2.csv (one row per loan; columns: dur, cause [1=default, 2=prepayment, 0=censored], vintage, term, ead, rate, fico, dti, resolved, lgd, ead_atdef, orig_dy, end_dy). Step 2 - reproduce all tables and figures: cd code python jrfm_reproduce.py This prints every numbered result (descriptive statistics; beta and default-incidence table; goodness of fit; PD term structure and Kaplan-Meier-vs-competing-risks bias; cause-specific Cox and Fine-Gray hazard ratios; out-of-sample integrated Brier score with bootstrap intervals, time-dependent AUC and calibration; crisis-vintage and calendar stress tests; discounted expected-credit-loss over-provisioning) and writes figures fig8-fig12 to the figs/ folder. All randomness is seeded (NumPy default_rng); Monte-Carlo summaries reproduce the reported values up to the stated standard errors. Scripts resolve paths relative to their own location, so they run from any working directory. Data provenance: data/prosper_cr2.csv is derived from the public Prosper Loan Data (Kaggle). Code is released under the MIT License; see LICENSE.txt.
Institutions
- National University of UzbekistanTashkent, Tashkent