Rise of the Machines_Application of Machine Learning_Schultz_Fabozzi
Rise of the Machines_Application of Machine Learning_Schultz_Fabozzi
Glenn M. Schultz
is the director of mortgage
KEY FINDINGS
prepayment modeling for
MUFG Securities, in n Machine learning mortgage prepayment models are proving competitive, if not superior,
New York, NY.
to the traditional modular mortgage prepayment model.
glenn.schultz@
mufgsecurities.com n Key to training a machine learning prepayment model is managing the bias variance
tradeoff through the proper selection of the machine hyperparameters.
Frank J. Fabozzi
is a professor of finance at n One of the most powerful techniques to improve performance of a machine learning
EDHEC Business School prepayment model is “boosting”; an ensemble method that improves the predictive
in Nice, France. accuracy of the model by combining the output of many “weak leaners” into a “strong
[email protected]
committee.”
ABSTRACT
Key to the valuation of agency residential mortgage-backed securities (MBSs) is the modeling
of voluntary prepayment and default behaviors of the underlying borrowers in the mortgage
pool. The proliferation of pool- and loan-level data coupled with access to advanced machine
learning algorithms has opened the door to the application of machine learning to mortgage
prepayment modeling. The modular prepayment model, one that relies on defined functions
to predict mortgage prepayment, has dominated the MBS market nearly since its inception.
However, machine learning models are beginning to make inroads and, in some cases, are
replacing traditional modular prepayment models. The modular and machine learning model
differ in the following ways: In the case of modular prepayment models, either added or multi-
plicative, the modeler defines the functional form of each feature as well as the “tuning” of the
parameters passed to each. Machine learning or “second generation” mortgage prepayment
models differ in the sense that the modeler “tunes” the hyperparameters that determine the
bias variance tradeoff while the machine determines the functional form of each feature of
the model. In this article, the authors propose a machine learning mortgage prepayment
model using a boosted gradient classifier, trained at the loan level and generalized to the
pool level. A gradient boosted classifier is a tree-based model using an ensemble of weak
learners to create a strong committee for prediction.
T
he residential mortgage-backed securities (MBSs) market comprises three
subsectors based on the type of issuer/guarantee: US government backed
securities (Government National Mortgage Association [Ginnie Mae GNMA]),
government-sponsored enterprises or GSEs (Fannie Mae/FNMA and Freddie Mac/
FHLMC), and private-label MBSs. Central to the valuation of residential MBS is the
modeling of the prepayment and default behaviors of homeowners. The data for
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 7
modeling prepayment and default behaviors are obtained from information provided
by the master servicer of MBS issuers on a regular basis. That information is in the
form of a remittance report that details the performance of the collateral (i.e., pool
of loans) backing the security. In the relatively recent past, loan-level data were not
readily available for residential MBS valuation. As a result, prepayment modeling was,
for the most part, based on the remittance data provided by the issuers.
In December 2004, the Securities and Exchange Commission (SEC) adopted
a comprehensive set of regulations for disclosure and reporting of publicly offered
asset-backed securities (ABSs). These regulations, which took effect on January 1,
2006, are commonly referred to as Regulation AB. Since MBSs are the major type
of ABS, Regulation AB applied to issuers of MBSs. However, Regulation AB applies
to private-label MBSs only and not MBSs issued by Ginnie Mae, Fannie Mae, and
Freddie Macs which are exempt from the reporting requirements of the Securities
Exchange Act of 1934. In August 2014, the SEC adopted the final Regulation AB
rules, referred to as Regulation AB II. These rules included asset-level information
requiring issuers to provide standardized loan-level information for ABSs collateral-
ized by residential mortgages, commercial mortgages, auto loans and leases, debt
securities, and re-securitizations.
Coincident with the effective date of Regulation AB in 2006, Freddie Mac began
releasing the loan-level data collateralizing all of its outstanding mortgage pools.
Prior to the adoption of Regulation AB II, Fannie Mae and Ginnie Mae began releasing
loan-level data starting around January 2013.
Each data set differs in terms of the historical data offered: (1) Freddie Mac’s
data set reports loan-level data on all securities outstanding and issued as of January
2006, (2) Fannie Mae’s data set provides loan-level data on those securities issued
on or after January 2013, and (3) GNMA’s data set reports loan-level data on all
securities outstanding and issued as of January 2013. In addition, Fannie Mae and
Freddie Mac provide historical credit data sets, derived from their loan-level data,
reporting delinquency, default, and voluntary repayment as of January 2000.
The purpose of this article is to apply machine learning tools to the modeling
of prepayment behavior of homeowners whose loans are securitized via the GSEs.
We provide modeling examples using the Freddie Mac loan-level data set because it
represents the more comprehensive release of loan-level data of the two GSEs. We
use the eMBS loan and pool-level data sets. eMBS, a leading provider of agency MBS
data, and Kodiak Advisors have developed an AWS Redshift implementation of the
eMBS database. In addition to the eMBS data, Bond Lab LLC maintains a database
of the Federal Housing Finance Agency (FHFA) home price indexes and FHLMC Primary
Mortgage Market Survey rates (PMMS®).
Cohort analysis is a direct result of the data limitations extant in the mortgage
market prior to the adoption of the final rules under Regulation AB, namely, reliance
on remittance data. Remittance data include cash flow due the investor each month,
scheduled principal, interest, prepaid principal, default recovery, and pool factor (i.e.,
a measure of the amount of the original loan that remains for the collateral). The
information provided in the remittance data allows the modeler to create data sets
reporting a measure of prepayments for an MBS: the single monthly mortality rate
(SMM). Thus, the modeling exercise becomes one of time-series analysis. Loan-level
data, in contrast, report and track the performance of each loan on a monthly basis.
A loan is either active or terminated. As a result, the modeling exercise becomes one
of classification—an accurate representation of the problem.
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
8 | Rise of the Machines: Application of Machine Learning to Mortgage Prepayment Modeling Winter 2022
Traditional cohort modeling is based on a modular approach. That is, each feature
of the model is specified via a function. Often, the parameter(s) of each function are
exposed to the user. The exposure of the function parameter(s) facilitates model user
adjustments (tuning) of the model, thereby allowing the user to express an opinion
with respect to the influence of each function—essentially regression analysis or
constrained optimization.
Central to all mortgage prepayment models are the following features that are
well known to impact mortgage prepayments:1
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 9
α − β × e−θ × loanage
π month + θ − 3
1 × α sin ×
2 3−1
where a sets the function’s maximum value, and q sets the point at which
the function reaches its maximum value.
§ Borrower incentive: Borrower incentive is calibrated twice. Once to describe
the borrower incentive of the fast payer cohort and second to calibrate the
slower payer borrower cohort. The borrower incentive function is
η − arctan ( x )
arctan [ x × π ] × β
π
where x is the borrower incentive, β an integer that defines the slope of the
response function, and h an integer that defines the location of the response
function.
§ Burnout: Burnout determines the population distribution between fast and
slower payer. The function for burnout is
The analyst may choose to “fit” the model via constrained optimization. Alterna-
tively, the analyst may choose to “tune” the model based on the analyst’s unique
outlook on the future of prepayment rates.
The above is intended to provide context and a point of reference for the current
state of prepayment modeling. The choice of the functional form of each feature
depends on the analyst’s preference. Nonetheless, mortgage prepayment modeling
follows the general framework above—it is both labor intensive and prone to bias.
Indeed, one can simply adjust the model in the way one sees proper irrespective
of the rationality behind each adjustment. This is often referred to as “turning the
knobs”—hardly an endorsement of the practice.
Our goal is to employ machine learning, in this case stochastic gradient boosting,
to train a mortgage prepayment model suitable for production in an analytic frame-
work. The prepayment model is trained at the loan level and generalized to the pool
level, returning an SMM vector given a forward interest rate path. Exhibit 1 outlines
the target variable and features of the model.
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
10 | Rise of the Machines: Application of Machine Learning to Mortgage Prepayment Modeling Winter 2022
EXHIBIT 1
Prepayment Model Target and Features
Target
Loan Status Integer Internal Discrete
Features
Loan Age Integer Internal Continuous
Seasonality Integer External Discrete
Borrower Incentive Decimal Internal Continuous
Incentive Lagged 1-mo. Decimal Internal Continuous
Incentive Lagged 2-mo. Decimal Internal Continuous
Mortgage Curve Decimal External Continuous
Mortgage Curve Lagged 1-mo. Decimal External Continuous
Mortgage Curve Lagged 2-mo. Decimal External Continuous
Spread at Origination Decimal Internal Continuous
Original Loan to Value Decimal Internal Continuous
Home Price Appreciation Decimal External Continuous
type of problem and the modeler’s determination of the proper algorithm to apply to
the problem. According to Garath et al. (2017), machine learning, simple or deep,
can be classified as follows:
3
See Zhang et al. (2019).
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 11
considered one of the better “off-the-shelf” data mining tools (Hastie 2012) for the
following reasons:
§ Interpretability: They are fast to construct and provided the tree is relatively
small, they produce interpretable models,
§ Robustness: They easily incorporate mixtures of numerical and categorical
variables and missing data and are immune to the influence of predictor
outliers.
§ Internal Feature Selection: They perform internal feature selection and thus
are resistant to the inclusion of irrelevant predictor variables.
Despite their strengths, tree models suffer from the following limitations according
to Hastie (2012):
Boosting
Given the weakness of tree models with respect to predictive accuracy, why
would an analyst choose to use a tree model for prediction? Boosting. Boosting
tree models dramatically improves their predictive accuracy while preserving their
desirable properties for data mining. However, the predictive accuracy of boosting
requires a tradeoff between speed and interpretability. Boosting combines the output
of many “weak” classifiers to produce a strong “committee.” Within this context a
weak classifier is one whose error rate is marginally better than a random guess.
Boosting sequentially applies the weak classification algorithm to repeatedly modified
versions of the training data. In turn, this produces a sequence of weak classifiers.
The predictions from the ensemble of the weak learners are then combined through
a weighted majority vote to produce the final prediction.
The “boosting” process is also referred to as a “strong committee” machine.
Strong committee machines may be of one of two types of ensemble averaging,
typically used with neural nets, or boosting, typically used with tree-based methods.
The difference between the two being that boosting trains the weak learners on data
sets with entirely different distributions. Thus, boosting serves as a method that can
improve the performance of machine learning algorithms.
Boosting was originally designed for classification problems and later extended
to regression problems. In the context of mortgage prepayment modeling, we focus
on boosting as a classification problem and train the model at the loan level using
monthly transaction data. That is, we will classify a loan, in any given period, as either
active (negative observation assigned a value of 0) or terminated (positive observation
assigned a value of 1).
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
12 | Rise of the Machines: Application of Machine Learning to Mortgage Prepayment Modeling Winter 2022
EXHIBIT 2
Learning Rate and Number of Learners
0.765
0.760
AUC
0.755
0.750
Hyperparameters
Most boosting models offer a number of hyperparameters that can be adjusted to
control the bias variance tradeoff of the model. The most significant are learning rate,
number of learners (trees), tree depth, and subsampling (row wise and column wise).
The learning rate is a regularization parameter. The simplest application of which
is to scale the contribution of each tree by a factor between 0 and 1. Smaller values
of the learning rate increase the training risk, holding the number of learners con-
stant. Consequently, both the learning rate and the number of learners control the
prediction risk given the training data. Further, the learning rate and the number of
learners are not independent of one another. That is, smaller values for the learning
rate lead to a larger number of learners.
Exhibit 2 shows the tradeoff between learning rate and the number of learners
using a tree depth of two. The objective function maximized is the area under the
receiver operating (ROC) curve, discussed in greater detail later in this article. The
grid search is conducted setting tree depth equal to two and testing the learning rate
over a number of learners from 250 to 2,000. As the number of learners increases
the area under the curve (AUC) generally increases. In this case monotonically, indi-
cating diminishing improvement in the model as the number of learners increases.
Generally speaking, the ROC curve that lies above is considered the “best” value for
the hyperparameter under consideration, in this case 0.30. However, research indi-
cates that a smaller learning rate and greater number of learners produce superior
results. Following the literature, we select a learning rate of 0.10.
Tree depth controls the interaction level. That is, no interaction levels greater
than tree depth—1 are possible. Thus, setting the tree depth equal to two results in
a boosted model with only main interactions; setting the tree depth equal to three
results in a boosted model with two variable interactions. The tree depth should
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 13
EXHIBIT 3
Tree Depth
0.765
0.760
AUC
0.755
0.750
3 5 7
Tree Depth
4 6 8
Learning Rate = 0.1
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
14 | Rise of the Machines: Application of Machine Learning to Mortgage Prepayment Modeling Winter 2022
EXHIBIT 4
Row and Column Subsampling
Panel A: Row Subsampling
0.766
0.764
0.762
AUC
0.760
0.758
0.766
0.764
0.762
AUC
0.760
0.758
0.756
500 1000 1500 2000
Number of Learners
In the case of the machine learning prepayment model, the modeler does not
determine the functional form of each feature (i.e., the task of the machine learning
algorithm). Still, the modeler must provide up to five hyperparameters balancing the bias
variance tradeoff such that the model generalizes well to the unseen or test data set.
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 15
True Positive
True Positive Rate =
True Positive + False Negative
True Negative
Specificity =
True Negative + False Positive
Exhibit 6 is the ROC curve for the prepayment model. The true positive rate and
false positive rate are calculated at different thresholds. A model with an AUC score
of 1.0 is a perfect model with complete separability between the negative and positive
classes. A model with an AUC score of 0 inverts the negative and positive classes,
EXHIBIT 6
AUC ROC Curve
1.00
AUC = 0.76
0.75
True Positive
0.50
0.25
0.00
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
16 | Rise of the Machines: Application of Machine Learning to Mortgage Prepayment Modeling Winter 2022
EXHIBIT 7
Feature Importance
incentive_1
loanage
mtgcurve_1
hpiratio
mtgcurve_2 Cluster
Features
1
mtgcurve_3 2
month
origltv
incentive_3
incentive_2
and a model with an AUC score of 0.50 cannot separate the negative and positive
classes. The model’s AUC ROC score, 76%, indicates that the model correctly clas-
sifies 76% of the positive classes, loan termination in the period.
Exhibit 7 presents the feature importance of the model. Each feature of the
model is scored according to its contribution to the model’s predictive accuracy. The
purpose of feature importance is to assist in the determination of the relationship
between the target variable and the feature. The dominate features of the model are
incentive_1, loan age, mortgage curve_1, and hpi ratio. Each feature is known to be
dominate drivers of voluntary mortgage termination.
Thus far, we have focused on assessing the model as a classifier. Model back-
testing is generalized to aggregate prepayments. That is, from the loan-level test
data we compute the current balance weighted feature values and SMM, which is
annualized to a conditional prepayment rate (CPR), thereby replicating the model’s
expected performance on pool-level data.
Exhibit 8 is a backtest of the test data for origination years 2011 to 2020. Over-
all, the model performs well and captures differences in the seasoning ramp of each
cohort. The notable exceptions are 2011, 2012, and 2015. The model overshot the
2011, 2012, and 2015 cohorts’ peak in the seasoning ramp. Nonetheless, overall,
the model appears to perform well across the vintage cohorts examined.
To assess the degree to which the classifier model generalizes to the cohort data,
we perform standard least squares regression in the following form:
SMMpredicted = α + β SMMactual
A good prepayment model will produce an a (intercept) and a β (slope) that are
not statistically different from either 0.0 or 1.0, respectively. Exhibit 9 summarizes the
analysis. With respect to all origination years, the intercept’s 2.5% and 97.5% confi-
dence interval is -0.0009 and -0.0002, respectively. Similarly, the 2.5% and 97.5%
confidence interval around the slope coefficient is 1.030 and 1.061, respectively. The
slope coefficient, for all origination years, indicates that for every unit change in the
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 17
EXHIBIT 8
Test Data Backtest
2011 2012
60%
40%
20%
0%
2013 2014
60%
40%
20%
0%
2015 2016
60%
CPR (%)
40%
20%
0%
2017 2018
60%
40%
20%
0%
2019 2020
60%
40%
20%
0%
01-2011
07-2011
01-2012
07-2012
01-2013
07-2013
01-2014
07-2014
01-2015
07-2015
01-2016
07-2016
01-2017
07-2017
01-2018
07-2018
01-2019
07-2019
01-2020
07-2020
01-2021
01-2011
07-2011
01-2012
07-2012
01-2013
07-2013
01-2014
07-2014
01-2015
07-2015
01-2016
07-2016
01-2017
07-2017
01-2018
07-2018
01-2019
07-2019
01-2020
07-2020
01-2021
Date
Actual Model
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
18 | Rise of the Machines: Application of Machine Learning to Mortgage Prepayment Modeling Winter 2022
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.
Winter 2022 The Journal of Fixed Income | 19
EXHIBIT 10
Scatter Plot: Predicted vs. Actual
60%
40%
Predicted
20%
0%
REFERENCES
Garath, J., D. Witten, T. Hastie, and R. Tibshirani. An Introduction to Statistical Learning: With
Applications in R. New York, NY: Springer, 2017.
Hastie, T. The Elements of Statistical Learning. New York, NY: Springer, 2012.
Schultz, G. M. Investing in Mortgage Backed and Asset Backed Securities: Financial Modeling with
R and Open-Source Analytics. Hoboken, NJ: John Wiley, 2016.
Schultz, G. M., and F. J. Fabozzi. “Agency Mortgage Passthrough Securities.” The Handbook of
Fixed Income Securities: 9th edition. New York, NY: McGraw Hill, 2016.
Zhang, J., X. Zhao, J. Zhang, F. Teng, S. Lin, and H. Li. 2019. “Agency MBS Prepayment Model
Using Neural Networks.” The Journal of Structured Finance 24 (4): 17–33.
Downloaded from https://pm-research.com/content/iijfixinc/31/3, at University of Illinois on January 21, 2025. Copyright 2021 With Intelligence LLC.
It is illegal to make unauthorized copies, forward to an unauthorized user, post electronically, or store on shared cloud or hard drive without Publisher permission.