Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Mortgage Credit Risk Modeling in R
Rating: 4.8 out of 5(7 ratings)
92 students

Mortgage Credit Risk Modeling in R

From Loan-Level Data to Examiner-Ready Model Production and Documentation
Created byBrian Field
Last updated 7/2026
English

What you'll learn

  • Build, validate, and document production-grade mortgage credit risk models in R from raw Freddie Mac loan tapes to audit-ready Quarto reports.
  • Estimate PD, LGD, and EAD for fixed-rate and ARM mortgages - and defend every assumption to a regulator using SR 11-7-compliant documentation.
  • Master the full credit risk analyst workflow: scorecard development, CECL reserves, fair lending testing, and ongoing model monitoring - all coded in R.
  • Go from install.packages("tidyverse") to a complete model risk management package - covering glmnet, survival, xgboost, scorecard, and Quarto along the way.
  • The only mortgage credit risk course that uses real Freddie Mac loan-level data end-to-end with every method implemented in R, not pseudocode.

Course content

14 sections • 122 lectures • 47h 27m total length
  • Pre 001 - A Note on Course Format3:06

    Switch to RStudio screen sharing for code-driven learning and build examiner-ready mortgage credit risk models in R through hands-on practice.

  • 0.1.1 - What this course is and who it's for32:20

    Clarify the course scope and target audience for mortgage credit risk modeling in R, guiding enrollment and setting expectations for learners new to credit risk analysis.

  • 0.1.2 - The regulatory landscape24:40

    Navigate the six regimes that form the U.S. mortgage credit risk modeling perimeter, mapping each regime to modeling, documentation, scope, or data work, with CECL and fair lending as focal pillars.

  • 0.1.3 - The model lifecycle and what you'll build24:12

    Explore the six-phase model life cycle - development, implementation, use, validation, change control, and decommissioning - across seven model artifacts, with wrappers and governance guiding CECL-ready credit risk models.

  • 0.1.4 - The pedagogical arc and how to use this course24:57

    Explore the pedagogical arc and how to use this course, outlining the three layers—lecture, module, and curriculum—and guidance for active engagement, coding, and path selection.

  • 0.2.1 - Hardware self-check and the two-tier path17:50

    Perform the hardware self-check to choose between teaching subset path and full dataset path for mortgage credit risk modeling in R, considering RAM, disk targets, cloud VM options, and capstones.

  • 0.2.2 - R, RStudio, and R Projects41:31

    Learn to set up and manage R projects using RStudio for mortgage credit risk modeling in R.

  • 0.2.3 - Package management with renv37:43

    Manage R package dependencies using renv in mortgage credit risk modeling projects, ensuring reproducible results and streamlined setup.

  • 0.2.4 - Git and change control45:27

    Use git and change control to manage your mortgage credit risk modeling projects in R, ensuring versioning, collaboration, and reproducible analyses.

  • 0.3.1 - Quarto for reproducible regulatory reporting20:24

    Install Corto and render a Corto document to produce a reproducible deliverable, tying R code, narrative, and outputs together; learn the four-layer reproducibility stack with R, here, renv, and git.

  • 0.3.2 - Downloading SFLLD from Clarity25:07

    Download the SF-LLD data from Clarity, extract q1 2019 origination and time files into data/raw/2019/extracted in your R project, and verify with file.info, noting the pre-July 2026 layout.

  • 0.3.3 - Building the demo slice42:25

    Build the demo slice for mortgage credit risk modeling in R. Explore a practical example that demonstrates how to apply the course concepts to real data.

  • 0.3.4 - First contact with the demo slice28:50

Requirements

  • Any prior exposure to R or another data language (Python, SAS, SQL) - we'll teach the R idioms but not how to think in code.
  • A statistics course at some point - undergraduate stats is plenty.
  • General awareness of consumer lending - you don't need to be a mortgage expert, but terms like LTV and FICO shouldn't be mysteries.
  • A laptop with 16 GB+ RAM. R, RStudio, and Git are all free.

Description

This course takes you from R-comfortable analyst to building fully validated, production-grade mortgage credit risk models - the same models used by banks, GSEs, fintech mortgage lenders, and the regulators who examine them. Across the main core (Modules 0-12, including Module 2A on Quarto) and optional extensions (capstones and an ARM appendix), you will construct a complete PD/LGD/EAD/CECL modeling framework for conventional conforming fixed-rate mortgages using real Freddie Mac Single-Family Loan-Level data.

You won't just learn about mortgage credit risk modeling - you will build every component yourself in R, step-by-step, with a practitioner guiding you through the exact workflow used in industry and reviewed by independent validation and regulatory examiners.


What You'll Learn

Set up a professional R environment with renv-locked reproducibility, R Project structure, and Git-based version control for sensitive loan data. Ingest, clean, and join Freddie Mac Single-Family Loan-Level origination and performance files, HMDA, FHFA HPI, and FRED macro data into a unified loan-month panel. Master mortgage mathematics for fixed-rate products - level-payment amortization, prepayment, curtailment, LTV trajectory, and HPI-driven mark-to-market LTV. Build a full Probability of Default scorecard using WoE/IV, logistic regression, monotonic binning, and points-to-double-the-odds scaling. Develop survival-based and competing-risks PD models - Kaplan-Meier, Cox proportional hazards, parametric Weibull, and Fine-Gray for prepayment vs. default. Build Loss Given Default models using beta regression, two-stage default-flag-plus-severity, and LTV-based curves with HPI stress sensitivity. Implement Exposure at Default using amortization schedules and curtailment behavior. Construct lifetime CECL reserves with vintage loss curves, roll-rate models, macro-linked satellite models, scenario blending, and Q-factor framework. Build a modern machine learning challenger - XGBoost with SHAP explainability and adverse action reason code generation. Conduct fair lending analysis using HMDA: denial rate disparities, rate spread analysis, redlining tests, BISG proxies, and disparate impact regression. Produce audit-ready documentation in Quarto: Model Development Documents, Validation Reports, Ongoing Monitoring Reports, and CECL disclosures. An optional appendix extends the framework to adjustable-rate mortgages using Freddie Mac's Non-Standard Dataset, with caps, floors, reset schedules, and payment shock.


Who This Course Is For

Mortgage credit risk analysts, model developers, and model validators. Bank, credit union, GSE, and fintech mortgage professionals. Data scientists transitioning into mortgage or consumer credit risk. Audit and Model Risk Management staff supporting mortgage portfolios. Career-changers preparing for risk, analytics, or model development roles in mortgage lending.


Module 0 covers the R toolchain, RStudio configuration, package management, and Git basics from a practitioner's angle - but you should be comfortable with basic R syntax, data manipulation, and undergraduate-level statistics. This is a practitioner course, not an introduction to programming.


Hands-On Projects You Will Build

By the end of the main core, you will have created a reproducible RStudio project with Freddie Mac Single-Family Loan-Level data, renv-locked dependencies, and Git history; a working teaching subset of SFLLD built from raw quarterly text files via a documented Arrow/Parquet pipeline; a fully exploratory analysis of origination attributes and performance trajectories with vintage and seasoning views; a validated PD scorecard with KS, Gini, AUROC, calibration, and out-of-time / out-of-sample validation; a survival-based lifetime PD model with competing-risks treatment of prepayment; a two-stage LGD model with HPI stress sensitivity; an EAD model accounting for amortization and curtailment; a complete CECL engine with vintage curves, roll-rate models, scenario blending, and back-testing; an XGBoost challenger model with SHAP explanations and reason codes; a full HMDA-based fair lending analysis with disparate impact testing and remediation; and an audit-ready Model Development Document, Validation Report, and PSI/CSI monitoring dashboard. Optional capstones extend the framework against the full Freddie Mac dataset; an optional ARM appendix module applies the methodology to adjustable-rate mortgages.


Every module ends with a tangible, portfolio-ready artifact. Every section ends with a hands-on lab. Every capstone ends with a complete documentation package.


Course Structure

The main core covers Modules 0 through 12, including Module 2A on Quarto for regulatory reporting. The Foundation phase (Modules 0, 1, 2, 2A) covers the R toolchain, mortgage credit risk fundamentals, data ingestion, and Quarto reporting. Mortgage Mechanics (Module 3) covers fixed-rate amortization, prepayment, LTV trajectory, and HPI mark-to-market. Core Models (Modules 4, 5, 6, 7) cover PD scorecards, survival PD, LGD, and EAD. Application (Modules 8, 9, 10) covers the ML challenger, fair lending, and CECL. Governance (Modules 11, 12) covers validation and ongoing monitoring. Optional extensions include capstones (Module 13) and an ARM appendix (Module 14).


Every lecture includes a complete instructor script, branded slide deck, runnable R code, exercises, knowledge checks, and session notes - produced and quality-controlled to a single consistent standard.


Why This Course Is Different

Most credit risk courses teach theory on toy data. Most R courses don't touch regulation. This course does both - using real Freddie Mac Single-Family Loan-Level data spanning the 2005-2007 crisis vintages through recent originations, with every method implemented in production-quality R code and every output framed for SR 11-7-compliant model documentation.

You'll learn not just how to build mortgage credit risk models, but how to defend them in independent validation, document them for regulatory examination, monitor them in production, and remediate them when fair lending or stability issues surface.

By the end, you'll be able to independently develop, validate, document, and govern mortgage credit risk models in a real-world environment - across PD, LGD, EAD, and CECL, with the regulatory and fair lending lens that examiners actually apply.

Who this course is for:

  • Mid-career risk analysts, model developers, model validators, and audit/MRM staff at banks, credit unions, GSEs, or fintech mortgage lenders. New graduates with strong stats and R skills can succeed but should expect to put in extra time on the regulatory modules.