---
title: "Mortgage Modelling"
book: "Rates, Credit, XVA and Risk"
subject: quant
language: en
chapter: 12
exercises: 8
source: https://one-course.com/books/quant/6/en/chapter/12-mortgage-modelling
---

# Chapter 12 — Mortgage Modelling

On 13 June 2003 the ten-year Treasury yielded 3.13%; on 2 September, 4.61%. Part of that move was the mortgage market hedging itself. American homeowners can repay their fixed-rate mortgages at any time; when rates fall they refinance, when rates rise they stay, so a mortgage-backed security shortens when rates fall and lengthens when they rise. Holders who keep their portfolios’ duration fixed must receive fixed as rates fall and pay fixed as they rise, and in the summer of 2003 they paid into a market that was already selling. A Federal Reserve study that year found that swap volatility rose when prepayment risk was high, consistent with hedging amplifying rate moves for months at a time. One Quant Book 2, chapter 12, described the market, its prepayment conventions and its negative convexity with a single rate path. This chapter models prepayment on many paths, prices a pool by option-adjusted spread, splits it into its interest and principal, and measures the hedge a 100-basis-point rise demands.

## 12.1 Anatomy of a prepayment model

**Definition 12.1 (Prepayment model).**

A *prepayment model* gives the conditional prepayment rate of a pool each month as a function of the pool’s characteristics (age, rate, loan size) and of the rate environment on the path; it is estimated on historical loan-level data and run path by path in valuation.

**Definition 12.2 (Housing turnover, refinancing incentive).**

*Housing turnover* is the part of prepayment that comes from home sales, defaults and curtailments, rising with loan age to a plateau and insensitive to rates. The *refinancing incentive* is the pool’s weighted-average coupon (WAC) minus the mortgage rate a borrower could get today: refinancing is worth it when the incentive exceeds the costs of doing so.

**Definition 12.3 (Prepayment S-curve, burnout).**

The *prepayment S-curve* is the refinancing speed as a function of the incentive: near zero out of the money, rising steeply over a few tens of basis points of incentive, flattening at a maximum. *Burnout* is the decline of a pool’s response to a given incentive after it has already been exposed to incentives: the borrowers who could and would refinance have left, and those who remain are slower.

The chapter’s model adds a turnover part at the PSA ramp (One Quant Book 2, chapter 12) to a refinancing S-curve with a maximum of 45% CPR and a centre at 75 basis points of incentive, damped by [burnout](#def-rc-mortgage-modelling-scurve) $e^{-0.25\,c}$ with $c$ the cumulative positive incentive in percentage-point years ([Figure 12.1](#fig-rc-mortgage-modelling-scurve)).

**Definition 12.4 (Current coupon, primary–secondary spread).**

The *current coupon* is the yield of a to-be-announced mortgage security priced at par, interpolated between the coupons that trade. The *primary–secondary spread* is the mortgage rate offered to borrowers (the primary market) minus the current coupon (the secondary market): the lenders’ and guarantors’ margin, which widens when origination capacity is scarce (in 2020 it ran 73 to 81 basis points above what demand explained, from March to September). A [prepayment model](#def-rc-mortgage-modelling-model) maps the rate paths to borrowers’ mortgage rates through both; the chapter uses the ten-year par swap rate plus a fixed 175 basis points.

```python
@dataclass
class PrepayModel:
    turnover_speed: float = 1.0     # PSA multiple for the housing-turnover part
    refi_top: float = 0.45          # maximum refinancing CPR
    refi_slope: float = 200.0       # steepness of the S-curve (per unit of incentive)
    refi_centre: float = 0.0075     # incentive at the middle of the S-curve
    burnout: float = 0.25           # decay per percentage-point year of past positive incentive
    mortgage_spread: float = 0.0175  # mortgage rate over the ten-year par rate

    def refi(self, incentive):
        return self.refi_top / (1.0 + np.exp(-self.refi_slope * (incentive - self.refi_centre)))

    def cpr(self, age: int, incentive, cum):
        return np.minimum(psa_cpr(age, self.turnover_speed) + self.refi(incentive) * np.exp(-self.burnout * cum), 0.95)
```

***Listing 12.1.** The prepayment model: turnover plus a refinancing S-curve damped by burnout. code/firm/mbsoas/firm_mbsoas.py*

![The refinancing S-curve of the chapter’s prepayment model, before burnout: annual refinancing speed against the incentive. Turnover adds a few per cent at every incentive. Illustrative parameters; the chapter’s tutorial.](https://one-course.com/images/onecourse/chapters/quant-6/rc-mortgage-modelling/fig-2fb4e4f976c5.svg)

***Figure 12.1.** The refinancing S-curve of the chapter’s [prepayment model](#def-rc-mortgage-modelling-model), before [burnout](#def-rc-mortgage-modelling-scurve): annual refinancing speed against the incentive. Turnover adds a few per cent at every incentive. Illustrative parameters; the chapter’s tutorial.*

## 12.2 Rate paths and path dependence

[Burnout](#def-rc-mortgage-modelling-scurve) makes each month’s prepayment depend on the path so far, and the balance left to prepay depends on all earlier prepayments: a pool cannot be valued on a tree of rates, only by simulation of whole paths.

**Method 12.5 (Path-wise valuation of a pool).**

Simulate monthly short-rate paths with chapter 7’s [Hull–White model](https://one-course.com/books/quant/6/en/chapter/7-short-rate-models#def-rc-short-rate-models-hw) (antithetic pairs). On each path, each month: compute the ten-year par rate from the model’s bond prices, the mortgage rate, the incentive and the CPR; run the pool’s amortisation (level payment, scheduled principal, prepayment of the rest); record interest and principal to investors. Discount each path’s cash flows at its short rate plus a spread, and average.

```python
def pool_flows(pool: Pool, model: PrepayModel, par10: np.ndarray):
    """Interest and principal to investors (paths x months)."""
    n, months = par10.shape
    bal = np.full(n, pool.balance)
    cum = np.zeros(n)
    interest, principal = np.zeros((n, months)), np.zeros((n, months))
    r = pool.wac / 12.0
    for k in range(months):
        age = pool.age + k + 1
        remaining = pool.term - pool.age - k
        if remaining <= 0:
            break
        incentive = pool.wac - (par10[:, k] + model.mortgage_spread)
        pay = level_payment(1.0, r, remaining) * bal
        sched = pay - bal * r
        pre = (bal - sched) * smm_vec(model.cpr(age, incentive, cum))
        interest[:, k] = bal * pool.coupon / 12.0
        principal[:, k] = sched + pre
        bal = bal - sched - pre
        cum += np.maximum(incentive, 0.0) * 100.0 / 12.0
    return interest, principal
```

***Listing 12.2.** The pool’s cash flows along every path at once. code/firm/mbsoas/firm_mbsoas.py*

## 12.3 The option-adjusted spread in practice

The option-adjusted spread of One Quant Book 2, chapter 21, is the constant spread over the model’s short rate that makes the average discounted cash flow equal to the market price.

**Definition 12.6 (Option cost).**

The *option cost* of a mortgage security is its zero-volatility spread (the spread that reprices it on the single path of forward rates) minus its option-adjusted spread: the value, in spread, of the borrowers’ prepayment options that volatile rates make valuable.

**Example 12.7 (A premium pool at par).**

A pool with a WAC of 6.0%, a coupon of 5.5%, 348 months left, on chapter 1’s SOFR curve (ten-year par rate 3.80% in the model’s annual convention, so a mortgage rate of 5.55% and an incentive of 0.45%), with Hull–White $\kappa = 3\%$, $\sigma = 90$ basis points and 4 000 paths, priced at 100: its option-adjusted spread is 146 basis points, its zero-volatility spread 181, and its [option cost](#def-rc-mortgage-modelling-optioncost) 34. Its effective duration is 4.99 years, its effective convexity $-123$, its weighted-average life 6.4 years. Without [burnout](#def-rc-mortgage-modelling-scurve) the same pool at the same spread would be worth 99.20: faster prepayment of a premium pool returns principal at par sooner.

**Definition 12.8 (Interest-only and principal-only strips).**

An *interest-only strip* (IO) receives a pool’s interest payments and a *principal-only strip* (PO) its principal payments, scheduled and prepaid; together they are the pool.

**Example 12.9 (Splitting the pool).**

At its option-adjusted spread the pool splits into an IO worth 25.26 and a PO worth 74.74. When rates rise 25 basis points the IO gains (26.61) and the PO loses (72.10): slower prepayment extends the interest stream and delays the principal. The IO is a rare asset with negative duration ([Figure 12.2](#fig-rc-mortgage-modelling-iopo)).

![Values of the pool’s principal-only and interest-only strips when the whole curve moves, at the pool’s option-adjusted spread. The PO rises steeply as rates fall and prepayments accelerate; the IO rises with rates. Data: the chapter’s tutorial.](https://one-course.com/images/onecourse/chapters/quant-6/rc-mortgage-modelling/fig-8f9f20eb2515.svg)

***Figure 12.2.** Values of the pool’s principal-only and [interest-only strips](#def-rc-mortgage-modelling-iopo) when the whole curve moves, at the pool’s option-adjusted spread. The PO rises steeply as rates fall and prepayments accelerate; the IO rises with rates. Data: the chapter’s tutorial.*

## 12.4 Hedging negative convexity

![The pool’s value against a parallel shift of the curve: below its tangent on both sides, the signature of negative convexity. Its gains from falling rates are capped by refinancing; its losses from rising rates grow as it lengthens. Data: the chapter’s tutorial.](https://one-course.com/images/onecourse/chapters/quant-6/rc-mortgage-modelling/fig-d63813fabfa5.svg)

***Figure 12.3.** The pool’s value against a parallel shift of the curve: below its tangent on both sides, the signature of negative convexity. Its gains from falling rates are capped by refinancing; its losses from rising rates grow as it lengthens. Data: the chapter’s tutorial.*

A holder hedged to zero DV01 is short gamma: after a rise it is long duration again and must pay fixed (or sell Treasuries) to re-hedge; after a fall it must receive. Its hedging trades are in the direction of the move, and when many holders run the same hedge, the trades move the market.

**Example 12.10 (One hundred basis points).**

After a 100-basis-point rise, at the same option-adjusted spread, the pool is worth 94.50 and its duration has lengthened from 4.99 to 6.17 years. On USD 10 billion of face the DV01 rises from USD 4.99 million to 5.83 million per basis point. A ten-year par swap on the shifted curve has a DV01 of USD 796 282 per billion, so the holder must pay fixed on USD 1.06 billion of ten-year swaps to be hedged again.

Who runs these hedges matters as much as how large they are. A holder that does not hedge duration, such as a central bank buying for policy reasons, absorbs negative convexity without trading it back into the market; when that holder stops buying and lets its holdings run off, the convexity returns to private hands, who hedge it.

![Mortgage-backed securities held outright by the Federal Reserve, month-end Wednesday levels, December 2002 to August 2026: zero before 2009, a peak of USD 2.72 trillion in February 2022, USD 1.91 trillion in August 2026. Source: Federal Reserve H.4.1 via FRED (series WSHOMCB, One Quant Book 2’s data file).](https://one-course.com/images/onecourse/chapters/quant-6/rc-mortgage-modelling/fig-27e076f09d7d.svg)

***Figure 12.4.** Mortgage-backed securities held outright by the Federal Reserve, month-end Wednesday levels, December 2002 to August 2026: zero before 2009, a peak of USD 2.72 trillion in February 2022, USD 1.91 trillion in August 2026. Source: Federal Reserve H.4.1 via FRED (series WSHOMCB, One Quant Book 2’s data file).*

**As of September 2026 — Who holds the convexity.**

The Federal Reserve’s holdings of agency mortgage-backed securities peaked at USD 2.72 trillion in February 2022 and stood at USD 1.91 trillion in August 2026, running off as pools prepay. Agency mortgage securities traded about USD 367 billion a day in 2026 to August, mostly in the to-be-announced market (SIFMA).

## 12.5 Model risk in prepayment

Every number above rests on a behavioural model: the S-curve’s centre and height, the [burnout](#def-rc-mortgage-modelling-scurve) rate, the mortgage-rate spread. They are estimated on past refinancing waves, and each new wave differs (technology that makes refinancing faster, tighter underwriting that makes it slower, a [primary–secondary spread](#def-rc-mortgage-modelling-cc) that widens when lenders are overloaded). Desks therefore report the option-adjusted spread under several models, compute prepayment “durations” (the sensitivity to scaling the model’s speeds), and hold reserves for model uncertainty (chapters 26 and 27).

## 12.6 Tutorial: a pool on many paths

**Goal.** Price a pass-through by option-adjusted spread, split it into strips, and measure its negative convexity. **End state:** Figures [12.2](#fig-rc-mortgage-modelling-iopo) and [12.3](#fig-rc-mortgage-modelling-price) and the numbers of Examples [12.7](#ex-rc-mortgage-modelling-oas) and [12.10](#ex-rc-mortgage-modelling-event).

1. **Paths** : `simulate_paths(curve, kappa, sigma, months, paths)` returns monthly short rates and ten-year par rates.
2. **Flows** : `pool_flows(pool, model, par10)` .
3. **Spread and risk** : `base()` , `duration_at(0.01, oas)` .
4. **Hedge** : `convexity_event()` ; `fig_rc_mbs.py` writes the charts.

**What to change next.** Double the S-curve’s slope and compare the convexity; raise the mortgage spread by 50 basis points (a widened [primary–secondary spread](#def-rc-mortgage-modelling-cc)) and measure the change in value.

## 12.7 Build: the OAS engine

**Purpose.** The mortgage book of the miniature firm: path-wise prepayment, option-adjusted spreads, strips and effective risk.

**Interface.** `Pool`, `PrepayModel` (with `refi`, `cpr`); `simulate_paths`; `pool_flows`; `pv_paths`; `solve_oas`; `analyse(curve, pool, model, price, kappa, sigma, paths)`.

**Rules.** Monthly steps; Book 2’s `firm_prepay` for the amortisation and the PSA ramp; common random numbers for every sensitivity; numpy only.

**Acceptance tests.** `code/firm/mbsoas/tests/`: with no prepayment the pool is an amortising loan on every path; the option-adjusted spread reprices and the strips add up; a pool near the money has negative convexity and a positive [option cost](#def-rc-mortgage-modelling-optioncost), its IO gains and its PO loses when rates rise; [burnout](#def-rc-mortgage-modelling-scurve) slows prepayment.

**Stretch.** A loan-level model with cohort data; a two-factor rate model; the dollar roll’s implied financing on model cash flows.

Sources and further reading

- R. Perli and B. Sack, “Does mortgage hedging amplify movements in long-term interest rates?”, Finance and Economics Discussion Series 2003-49, Federal Reserve Board.
- US Department of the Treasury, *Daily Treasury Par Yield Curve Rates* , 2003.
- L. Hayre (ed.), *Salomon Smith Barney Guide to Mortgage-Backed and Asset-Backed Securities* , Wiley, 2001.
- A. Fuster, A. Hizmo, L. Lambie-Hanson, J. Vickery and P. S. Willen, “How resilient is mortgage credit supply? Evidence from the COVID-19 pandemic”, NBER Working Paper 28843.

## 12.8 Exercises

**Exercise 12.1 ★.**

A pool’s WAC is 6.0% and the ten-year par rate is 3.80%. With a mortgage spread of 1.75%, what is the [refinancing incentive](#def-rc-mortgage-modelling-turnover)?

**Solution of Exercise 12.1.**

The mortgage rate is $3.80+1.75 = 5.55\%$; the incentive $6.00-5.55 = 0.45$ percentage point, just below the S-curve’s centre.

**Exercise 12.2 ★.**

Using [Example 12.7](#ex-rc-mortgage-modelling-oas), what is the [option cost](#def-rc-mortgage-modelling-optioncost), and what does it measure?

**Solution of Exercise 12.2.**

$181-146 = 34$ basis points (35 before rounding the two spreads): the part of the pool’s yield over the curve that pays for the borrowers’ prepayment options once rates are volatile, measured as a spread.

**Exercise 12.3 ★.**

Why does the IO gain when rates rise?

**Solution of Exercise 12.3.**

Higher rates slow refinancing, so the balance on which interest is paid survives longer; the extra interest more than offsets the higher discounting.

**Exercise 12.4 ★★.**

Why can a pool not be valued on a recombining tree, as a Bermudan can?

**Solution of Exercise 12.4.**

Prepayment depends on the path ([burnout](#def-rc-mortgage-modelling-scurve), the remaining balance), not only on the current rate: two paths reaching the same node carry different pools. A recombining tree forgets the path; simulation keeps it.

**Exercise 12.5 ★★.**

Read [Figure 12.3](#fig-rc-mortgage-modelling-price): estimate the gain from a 100-basis-point fall and the loss from a 100-basis-point rise, and compare them.

**Solution of Exercise 12.5.**

A fall of 100 basis points gains about 4.54, a rise loses about 5.50: the losses exceed the gains, the asymmetry of negative convexity.

**Exercise 12.6 ★★.**

Without [burnout](#def-rc-mortgage-modelling-scurve) the pool is worth 99.20 at the same spread. Explain the sign.

**Solution of Exercise 12.6.**

Without [burnout](#def-rc-mortgage-modelling-scurve) borrowers keep refinancing at the rate the S-curve says, so the premium pool (coupon above the market’s) returns principal at par faster, cutting off the above-market coupon earlier: its value falls, to 99.20.

**Exercise 12.7 ★★★.**

*Coding.* Reproduce the re-hedge of [Example 12.10](#ex-rc-mortgage-modelling-event): the DV01 before and after the rise on USD 10 billion, and the ten-year swap notional.

**Solution of Exercise 12.7.**

DV01 before $4.99\times100/100\times10\text{ billion}\times10^{-4} = \text{USD}~4.99$ million per basis point, after $6.17\times94.50/100\times\ldots = 5.83$ million; the extra USD 844 025 per basis point divided by the ten-year swap’s USD 796 282 per billion gives USD 1.06 billion of payer swaps.

**Exercise 12.8 ★★★.**

*Find the flaw.* “Our MBS book is duration-hedged daily, so it has no rate risk.”

**Solution of Exercise 12.8.**

Duration hedging removes first-order risk only: the book is short convexity (and short volatility through the borrowers’ options), so it loses on large moves in either direction between re-hedges, pays bid–offer on every re-hedge, and carries prepayment-model and mortgage-spread risk that no rate hedge covers.

## 12.9 Problem: The Convexity Event

**Problem 12.1.**

Weekend problem — a portfolio re-hedges after a sell-off

A mortgage investor holds USD 10 billion of the chapter’s pool, hedged to zero DV01 with ten-year payer swaps. Rates rise by 100 basis points in parallel.

**Part I — Before.**

1. Give the pool’s option-adjusted spread, zero-volatility spread and [option cost](#def-rc-mortgage-modelling-optioncost) .
2. Give its duration and convexity.
3. Give the DV01 of the holding, per basis point.
4. How much of the value is interest, how much principal?
5. Which of the investor’s positions is short options, and to whom?

**Part II — The rise.**

6. Give the pool’s value after the rise at the same spread.
7. Give its new duration and the holding’s new DV01.
8. Why did the duration lengthen?
9. Give the notional of ten-year payer swaps needed to re-hedge.
10. What happens if every mortgage investor does the same trade on the same day?

**Part III — Strips.**

11. Give the IO’s and PO’s values at $\pm25$ basis points.
12. Which strip hedges the other’s convexity?
13. Why do IOs appeal to banks with deposits whose value rises with rates?
14. What does a PO holder lose if refinancing slows for reasons unrelated to rates?
15. Which strip is more exposed to prepayment-model risk?

**Part IV — Judgement.**

16. Should the investor hedge with swaptions instead of swaps? What would it cost?
17. Why did the 2003 episode last months rather than days?
18. How would a central bank holding mortgage securities change the dynamics?
19. State the *named result* : the DV01 before and after and the swap notional of the re-hedge.
20. In one sentence: why does a mortgage lengthen when you least want it to?

**Solution of Problem 12.1.**

**1.** 146, 181 and 34 basis points. **2.** 4.99 years and $-123$. **3.** USD 4.99 million per basis point. **4.** Interest 25.26, principal 74.74 per 100. **5.** The pool: it is short the borrowers’ options to prepay, sold implicitly by lending to them at a fixed rate with a free prepayment right. **6.** 94.50. **7.** 6.17 years; USD 5.83 million per basis point. **8.** Higher rates move the pool out of the refinancing S-curve: prepayments slow and the principal comes back later. **9.** USD 1.06 billion of ten-year payer swaps. **10.** Their payer swaps push swap rates up further, which lengthens the pools again, which requires more hedging: a feedback the Federal Reserve study found in the data. **11.** IO 24.00 at $-25$ and 26.61 at $+25$; PO 77.21 and 72.10. **12.** The IO, whose value rises with rates, offsets part of the PO’s (and the pool’s) negative convexity. **13.** Deposits that reprice slowly are worth more when rates rise; an IO behaves the same way and can hedge the bank’s balance sheet (chapter 24). **14.** Value: the principal arrives later than priced, at the same par amount. **15.** The IO: its value depends almost entirely on how long the balance survives. **16.** Swaptions would buy back convexity and cost option premium (the pool’s [option cost](#def-rc-mortgage-modelling-optioncost) is the benchmark); many holders mix both. **17.** Duration extends gradually as rates rise and re-hedging flows spread over weeks; volatility rises and feeds back, and the Fed study found the effects persist for months. **18.** A holder that does not hedge removes part of the feedback; one that stops buying (runs off its holdings) shifts the hedging to private holders and can raise it. **19.** Named result: *the convexity event*: on USD 10 billion of the pool a 100-basis-point rise lifts DV01 from USD 4.99 million to 5.83 million per basis point, and re-hedging takes USD 1.06 billion of ten-year payer swaps. **20.** Because borrowers stop refinancing when rates rise, exactly when the holder would like its money back.

## 12.10 Interview questions

**Interview question 12.1 ★ trader, researcher.**

Why do mortgage-backed securities have negative convexity?

**Solution of Interview question 12.1.**

Borrowers can prepay at par whenever rates fall: the security’s price gains are capped as rates fall (it shortens) and its losses grow as rates rise (it lengthens). It is a bond minus a call option held by the borrowers.

*What the interviewer is looking for: the embedded prepayment option and asymmetric price moves.*

**Interview question 12.2 ★★ researcher.**

What goes into a [prepayment model](#def-rc-mortgage-modelling-model), and which parts depend on rates?

**Solution of Interview question 12.2.**

Turnover (home sales, defaults, curtailments; age-driven, little rate dependence); refinancing (an S-curve in the incentive, WAC minus mortgage rate, damped by [burnout](#def-rc-mortgage-modelling-scurve) and pool characteristics); the mortgage rate from market rates through the [primary–secondary spread](#def-rc-mortgage-modelling-cc). Refinancing and the mortgage rate depend on rates.

*What the interviewer is looking for: the components and which are rate-driven.*

**Interview question 12.3 ★★ researcher, developer.**

How do you compute an option-adjusted spread, and why Monte Carlo?

**Solution of Interview question 12.3.**

Simulate rate paths from a calibrated term-structure model; run the [prepayment model](#def-rc-mortgage-modelling-model) and the pool’s cash flows on each path; find the constant spread over the path’s short rate that makes the average discounted cash flow equal the price. Monte Carlo because prepayment is path-dependent.

*What the interviewer is looking for: paths, cash flows, spread root-finding, and path dependence.*

**Interview question 12.4 ★★ trader.**

Rates sell off 50 basis points. What do mortgage hedgers do, and what does it do to the market?

**Solution of Interview question 12.4.**

Their pools lengthen; to keep duration they pay fixed in swaps or sell Treasuries, adding to the sell-off; implied volatility rises as hedgers buy options; the move can overshoot before the flows exhaust.

*What the interviewer is looking for: hedging flows in the direction of the move.*

**Interview question 12.5 ★★★ risk, researcher.**

How would you measure and reserve for prepayment-model risk?

**Solution of Interview question 12.5.**

Run several [prepayment models](#def-rc-mortgage-modelling-model) or perturbed parameters (speed multipliers, S-curve shifts, [burnout](#def-rc-mortgage-modelling-scurve)), compute the option-adjusted spread and risk under each, report prepayment durations, and reserve for the dispersion of values; back-test the model against realised speeds by cohort.

*What the interviewer is looking for: scenario dispersion and back-testing.*

**Interview question 12.6 ★★★ developer.**

Your effective duration jumps from day to day by half a year with no market move. What do you check?

**Solution of Interview question 12.6.**

Random numbers not common across the bumped runs (a new seed each time), too few paths, path sets that change size, the curve or volatility inputs moving, and the finite-difference bump interacting with a steep S-curve; fix seeds and paths, use antithetics, and check the bump size.

*What the interviewer is looking for: common random numbers and noise diagnosis.*
