Cover Page

The Wiley Finance series contains books written specifically for finance and investment professionals, as well as sophisticated individual investors and their financial advisors. Book topics range from portfolio management to e-commerce, risk management, financial engineering, valuation and financial instrument analysis, as well as much more. For a list of available titles, visit our website at www.WileyFinance.com.

Founded in 1807, John Wiley & Sons is the oldest independent publishing company in the United States. With offices in North America, Europe, Australia and Asia, Wiley is globally committed to developing and marketing print and electronic products and services for our customers' professional and personal knowledge and understanding.

Investing in
Mortgage-Backed
and Asset-Backed
Securities

Financial Modeling with R and Open Source Analytics + Website

GLENN M. SCHULTZ, CFA
FOREWORD BY
FRANK J. FABOZZI, PH.D., CFA

 

Title Page

To Missi and Blake

Foreword

Glenn's 20+ years of experience in structured finance is reflected in this book. Portfolio management, MBS investment banking and structuring, and loan level prepayment modeling are among his expertise. Glenn contributed to The Handbook of Fixed-Income Securities, several editions of The Handbook of Mortgage-Backed Securities, and The Handbook of Nonagency Mortgage-Backed Securities. In 2003, he was honored for his structuring expertise with the IDD/ASR award for the Most Innovative ABS Transaction of the Year.

Glenn's broad experience highlights that investing in mortgage-backed securities requires a multidisciplinary approach including securities law, structuring techniques, and the modeling of econometric data and consumer behavior, both of which fall under the rubric of big data analysis. Furthermore, the proliferation of data and the analysis thereof have brought the concept of reproducible research to the forefront. Ultimately, research or experiments that can be reproduced are more reliable than those which cannot be reproduced. Reproducing the research of others is not only a checking process but it also provides a jump-point for future exploration. Investing in Mortgage-Backed and Asset-Backed Securities was written in the spirit of reproducible research and introduces Bond Lab, the first object-oriented and open source software that Glenn created for the analysis of mortgage- and asset-backed securities.

Bond Lab is programmed in R, the statistical computing language of choice, and allows the reader to replicate the analysis presented herein, view the code that created the results, and extend the analysis in any direction one chooses. Furthermore, the commercial acceptance of R on cloud computing platforms offers the investor a promise of unlimited scalability. By harnessing the power of R and open source computing, Bond Lab charts the course for the investor to create a custom technology stack meeting and expressing one's unique view with respect to the mortgage-backed securities market, thereby creating true alpha.

Frank J. Fabozzi, Ph.D, CFA
Professor of Finance, EDHEC Business School
and
Editor, Journal of Portfolio Management

Preface

It is not the critic who counts;…The credit belongs to the man who is actually in the arena,…who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat.

Theodore Roosevelt

Welcome to the arena of structured finance. The purpose of this book is to hone the skills needed to successfully compete in the arena. Bond Lab and the Companion to Investing in MBS are the training tools, both of which are programmed in the R computing language. This analysis presented in this book is based on Bond Lab version 0.0.0.9000. Bond Lab is, to my knowledge, the first open source object-oriented software designed for the analysis of structured securities. Bond Lab allows the reader to replicate the analysis presented herein, as well as extend the analysis in any direction she chooses thereby creating a richer learning experience and greater understanding of the material.

Investing in Mortgage-Backed and Asset-Backed Securities, was written in the spirit of reproducible research and its underlying philosophy is simple: Mortgage-backed securities are not too complex to understand. In fact, the basic valuation techniques applicable to all fixed-income securities also form the foundation for the valuation of mortgage-backed securities (MBS) and asset-backed securities (ABS). The perceived complexity of investing in structured products, like MBS, can be attributed to four sources:

  1. The contingency of residential MBS cash flows, which manifest because the borrower holds the option to prepay and terminate her mortgage obligation early.
  2. Cash flow structuring techniques based on the allocation of principal and interest across real estate mortgage investment conduit (REMIC) structures.
  3. Credit structuring techniques that allocate losses through the capital structure of a transaction.
  4. Valuation techniques that “simulate” the economy—interest rate models.

Organization of the Book

The main goal of this book is to develop a basic framework for the analysis of mortgage- and asset-backed securities using open source software. The financial models presented throughout the book are developed using R [R Core Team 2013], a freely downloaded open source software development environment.

Many people think of R as a statistics package, however it is much more. The R environment is an “integrated suite of software facilities for data manipulation, calculation, and graphical display” [Smith and R Core Team 2013]. As such, R lends itself easily to the development of an integrated financial analysis tool.

Investing in structured products also requires managing large sets of data. Aside from market data, like swap rates and Treasury prices and yields, the structured product investor must also follow borrower transaction data. Examples include voluntary prepayment rates, payment of scheduled principal and interest, and borrower delinquency and default. More often than not the investor must monitor this information at the loan level. Loan level data are becoming more available, and there are a host of vendors that offer the aggregation and delivery of this kind of data. The loan level data that is needed by the investor to monitor collateral performance is also freely available via trustee and/or issuer websites. In this book, we will use MySQL®, also open source, as the data management solution.

Investing in MBS is divided into five parts. Part One, Valuation of Fixed-Income Securities, introduces the reader to the techniques used to value all fixed-income securities.

Part Two, Residential Mortgage-Backed Securities, introduces the reader to mortgage-backed securities.

Part Three, Valuation of Mortgage-Backed Securities, introduces the reader to the basic valuation techniques used to determine relative value in the mortgage-backed securities market.

Part Four, Structuring Mortgage-Backed Securities, introduces the reader to the structuring techniques used in the mortgage-backed securities market. MBS structuring relies on the division of principal and interest to create notes derived from MBS cash flows that are tailored to meet investors' unique risk/reward profiles. Further, the structuring techniques used by dealers alter both the timing and valuation of MBS cash flows. Option-adjusted spread analysis is used throughout the section to explore how the division of principal and interest alter mortgage cash flow valuations.

Part Five, Mortgage Credit Analysis, covers default modeling, self-insuring mortgage structures, and the basics of sizing mortgage credit enhancement. A self-insuring structure is one whose credit enhancement is internally created which may subject the investor to principal loss resulting from borrower defaults. Thus, it is imperative that the investor understands default modeling, loss simulation, and the allocation of losses across the transaction's capital structure.

Acknowledgments

The Bond Lab® project would not have been possible without the support of my family and friends. To my wife, Missi, thank your for your neverending support, encouragement, and most importantly, your patience throughout the project. Justin D. Wolf, my best friend, thank you for your tireless efforts editing Investing in Mortgage-Backed and Asset-Backed Securities. You served as a reliable and trusted consultant and editor, meticulously reviewing each sentence, and the conceptual frameworks presented—any remaining ambiguity or grammatical errors are my full responsibility. Frank J. Fabozzi, PhD, CFA—over the years Frank was kind enough to include me in many of his works and together we edited Structured Products and Related Credit Derivatives. This book reflects the insights and experiences gained by working with Frank over many years. Chris J. Carney, your enthusiasm for the Bond Lab project and vision of creating an open source analytic program provided a wellspring of motivation. Steve J. Sinclair, your advice and counsel was invaluable as I navigated the world of object-orientated programming. The R core team, R community, and members of the R-help mailing list provided timely and insightful answers to many of my questions as I developed Bond Lab.

R Software Packages Used

The following R software packages were used for the Bond Lab project. The R packages devtools, roxygen2, and testthat provided the development and documentation environment. In addition, Bond Lab makes use of lubridate, termstrc, and optimx. All the graphics presented herein, with the exception of 13.1, were created using ggplot2 and reshape2, 13.1 was created using GIMP, also open source. I extend my gratitude to the authors and maintainers of these R packages:

Introduction

The inspiration for Bond Lab arose from the recommendation on the part of the Structured Finance Industry Group to provide mortgage and consumer asset-backed bond payment rules, commonly referred to as the waterfall, in an open source programming language. Although well intended, the recommendation suffered from the following problems:

Bond Lab is an example of open source software designed for the analysis of fixed-income securities with an emphasis on structured securities. It defines the classes, superclasses, structural elements, and methods required to create a structured security before the investor can begin to perform cash flow, relative value, and risk analysis.

The examples used in this book assume securities whose factor or origination date occurred sometime during January 2013, a random choice on my part. Swap rate data, taken from the Federal Reserve's website, is available for the month. The examples are:

Bond ID Bond Type Structure
bondlab5 Bond 5-year semi-annual coupon
bondlab10 Bond 10-year semi-annual coupon
bondlabMBS4 Mortgage 30-year pass-through
bondlabMBS5 Mortgage 30-year pass-through
BondLabMBSIO Mortgage IO strip
BondLabMBSPO Mortgage PO strip
BondLabPAC1 PAC REMIC tranche
BondLabCMP1 companion REMIC tranche
BondLabSEQ1 sequential REMIC tranche
BondLabSEQ2 sequential REMIC tranche
BondLabSEQ3 sequential REMIC tranche
BondLabSEQ4 sequentialIO REMIC tranche
BondLabPAC2 PAC REMIC tranche
BondLabFloater floater REMIC tranche
BondLabInverse inverse REMIC tranche
BondLabPACZ PAC REMIC tranche
BondLabCMP_Z companion REMIC tranche
BondLabZ accrual bond REMIC tranche

Finally, the Bond Lab structuring tool allows the reader to create any structure by defining the REMIC, its tranches, collateral group, and payment waterfall. Thus, the reader may extend her analysis and investigation in any direction she chooses. The Companion to Investing in MBS (companion2IMBS) provides a gentle introduction to BondLab, calling much of the functionality presented herein.

Part One
Valuation of Fixed-Income Securities