Sub topic 15
Pathwise valuation and Monte Carlo simulation
This chapter assumes you can value an option-free bond on a binomial interest rate tree by backward induction. It also assumes you know what a spot rate and a discount factor are, and that you can compute an expected value. Pathwise valuation reaches the same arbitrage-free value by a different route. It is the standard tool when a cash flow depends on how rates got to where they are, and not only on where they are now.
Valuing along paths instead of nodes
Backward induction works from maturity back to today. At each node it needs only the next period's values. That is possible because the cash flow at a node depends on that node's rate and nothing else.
Pathwise valuation works forward. It follows these steps:
- Generate many possible paths of one-period interest rates, from a model that is consistent with today's curve.
- For each path, discount every cash flow at the rates on that path. The discount factor for time k is the product of 1/(1 + r) over the periods before k.
- Average the path present values.
On a binomial tree with equal probabilities, every path is equally likely. The average over all paths therefore equals the backward-induction value exactly. The tree is only a compact way of storing paths that share a past.
Why use paths at all
A tree node does not remember how it was reached. Many real cash flows do remember. A mortgage-backed security is the standard example. Its prepayment speed depends on whether rates fell earlier in the path, because borrowers who already refinanced are gone. Two paths can reach the same rate today and have different pools outstanding.
On a recombining tree, the node value cannot capture that history. Pathwise valuation can, because each path carries its full history. Inside the loop over paths, you can let each period's cash flow depend on anything that happened earlier on that path.
An exact pathwise calculation
The code below uses the 3-year tree from the earlier chapters. Here rates[t][j] is the one-period rate at time t after j up moves, with up meaning a higher rate. It enumerates all 8 paths and averages them. It then draws random paths from the same tree, which is Monte Carlo, and reports the standard error. Finally it finds the OAS against an assumed market price.
import itertools
import random
import statistics
rates = [[0.03], [0.025, 0.035], [0.02, 0.03, 0.04]] # illustrative, not calibrated
coupon, face = 5, 100
def path_value(moves, spread=0.0):
# moves is a tuple of 0 (down) or 1 (up), one per period
ups, df, pv = 0, 1.0, 0.0
for t, move in enumerate(moves):
df /= 1 + rates[t][ups] + spread
cash_flow = coupon + (face if t == len(moves) - 1 else 0)
pv += cash_flow * df # cash flow arrives at time t + 1
ups += move
return pv
all_paths = list(itertools.product((0, 1), repeat=3))
exact = sum(path_value(p) for p in all_paths) / len(all_paths)
print("exact average over 8 paths:", round(exact, 4))
random.seed(7)
draws = [path_value(tuple(random.randint(0, 1) for _ in range(3))) for _ in range(20000)]
se = statistics.stdev(draws) / len(draws) ** 0.5
print("Monte Carlo mean:", round(statistics.mean(draws), 4), "std error:", round(se, 4))
def model_value(spread):
return sum(path_value(p, spread) for p in all_paths) / len(all_paths)
market_price = 104.0 # assumed for the example
lo, hi = -0.05, 0.05
for _ in range(60): # model value falls as the spread rises
mid = (lo + hi) / 2
if model_value(mid) > market_price:
lo = mid
else:
hi = mid
print("spread over every path rate:", round(mid * 10000, 1), "bp")The exact average is about 105.667. It matches what backward induction gives for the same bond on the same tree. The Monte Carlo mean lands near that figure but not on it. The gap is sampling error, and the standard error tells you how large it is likely to be.
Monte Carlo: when the tree is too small
A tree with n periods has 2^n paths. At 360 monthly periods for a mortgage, that is far too many to list. Monte Carlo draws a random sample of paths instead and averages them.
Three points govern how well it works:
- Error shrinks slowly. The standard error falls with 1/√N. Cutting the error in half takes four times as many paths.
- Variance reduction helps. Antithetic paths pair each random shock with its mirror image. Using the same random draws when you reprice at different spreads or shifted curves also keeps comparisons stable. The code above reuses the same path set for each spread for this reason.
- The sample is not the model. The model rate dynamics are the assumption. Many paths make the average accurate for that model, but they do not make the model correct.
Keeping the paths arbitrage-free
Random paths must be built so that discounting benchmark bonds along them reproduces today's market prices. This is a calibration step, usually done by adjusting each period's drift. If the paths skip it, the model prices a Treasury or swap curve incorrectly, and any value you compute for another bond is unreliable. The check is simple: average the discounted par payoff of a 1-year, 2-year, and 3-year benchmark across your paths and compare with market prices.
OAS on paths
The option-adjusted spread is a constant added to the one-period rate in every period of every path. You choose it so that the average path value equals the market price. In the code, that is the spread argument, found by bisection.
The Z-spread does not model rate uncertainty. It adds a constant to spot rates in a single certain scenario. The OAS adds a constant to the rates on every simulated path. For a bond with an embedded option, the OAS removes the option's value from the spread, because the option's effect is already in the cash flows. When the option has value, so the issuer or holder behaves differently across paths, the OAS is lower than the Z-spread for a callable bond. For an option-free bond, the two spreads are close, and they are equal if rates have no volatility.
Limits compared with a tree
| Feature | Binomial tree | Monte Carlo paths |
|---|---|---|
| Direction | Backward from maturity | Forward along each path |
| Result | Exact for the tree | Sample estimate with standard error |
| Path-dependent cash flows | Awkward | Natural |
| Optimal exercise of an option | Natural, compare at each node | Hard, needs extra methods |
| Cost grows with | Number of periods | Number of paths times periods |
The exercise decision is the main weakness. A callable bond's call decision at a node compares the continuation value with the call price. Continuation value looks to the future, and a forward-running path does not know the future of that path. Practitioners use regression-based methods to estimate it. That is beyond this chapter's scope, and it is why callable bonds are usually valued on trees and mortgage securities on paths.
Effective duration from paths
Effective duration and convexity use the same bump-and-reprice idea as before. Shift the benchmark curve up and down by a small amount, rebuild and recalibrate the paths, hold the OAS constant, and reprice. Keep the OAS fixed so that only the curve shift changes the value. Reuse the same random draws across the shifted runs so that sampling noise cancels in the differences. Otherwise the noise can be larger than the small price change you are measuring.
Exercise
A Monte Carlo valuation with 10,000 paths gives a standard error of 0.20 on a bond price. About how many paths are needed to cut the standard error to 0.05, and why?
Show answer
About 160,000 paths. The standard error falls with 1/√N, so cutting it by a factor of 4 requires 16 times as many paths: 10,000 × 16 = 160,000.
Exercise
On a recombining binomial tree with equal probabilities, you average the present values of all paths and compare with backward induction. What do you find, and when would you still prefer paths?
Show answer
The two values are identical, because each path has the same probability and discounting along a path uses the same rates the tree uses at each node. You would prefer paths when a cash flow depends on the route taken, such as prepayments in a mortgage-backed security that depend on earlier rate declines.
Exercise
A bond's average path value is 105.67 when discounted at the model's rates. Its market price is 104.00. Is the OAS positive or negative, and what does it mean?
Show answer
Positive. A positive constant must be added to the rates on every path to lower the average value from 105.67 to 104.00. The market demands extra yield beyond the model's benchmark-consistent rates after allowing for the option, which compensates for credit, liquidity, or other risks.