Sub topic 11
Macaulay Duration: Weighted Average Time to Cash Flows
This chapter assumes you can price a bond as the present value of its cash flows and that you know what yield to maturity (YTM) means. It also assumes you are comfortable reading short Python functions. By the end you should be able to compute Macaulay duration by hand and in code, and explain what the number says about a bond.
What Macaulay duration measures
A bond pays its cash flows at different dates. A 3-year bond pays small coupons at years 1 and 2 and a large final payment at year 3. Maturity alone says only when the last payment arrives. It ignores how much of the bond's value comes earlier.
Macaulay duration answers a different question: on average, how long does an investor wait to receive the bond's value? It is the weighted average of the times of the cash flows. Each time is weighted by the share of the bond's price that cash flow represents.
The formula is:
Macaulay duration = Σ [ t × PV(CF_t) / Price ]
tis the period in which the cash flow arrives.PV(CF_t)is that cash flow discounted at the YTM per period.Priceis the sum of all the present values, so the weights add up to 1.
Duration is measured in years. If you count t in periods, as with semiannual bonds, divide the result by the number of periods per year.
Worked example: 3-year, 5% annual-pay bond at a 4% yield
Par value is 100. Discount each cash flow at 4%, then weight each time by the present value's share of the price.
| t (years) | Cash flow | PV at 4% | Weight (PV / price) | t × weight |
|---|---|---|---|---|
| 1 | 5 | 4.8077 | 0.04678 | 0.04678 |
| 2 | 5 | 4.6228 | 0.04498 | 0.08996 |
| 3 | 105 | 93.3446 | 0.90824 | 2.72473 |
| Total | 102.7751 | 1.00000 | 2.8615 |
The Macaulay duration is about 2.86 years. The bond matures in 3 years, but the early coupons pull the average time to payment below that. The last cash flow carries about 91% of the weight, so the duration sits close to 3.
Computing it in Python
The function below extends the pricing code from earlier chapters. It handles any payment frequency and divides by freq at the end so the answer is in years.
def macaulay_duration(face, coupon_rate, ytm, years, freq=1):
n = int(round(years * freq))
c = face * coupon_rate / freq
y = ytm / freq
pvs = []
for t in range(1, n + 1):
cf = c + (face if t == n else 0)
pvs.append(cf / (1 + y) ** t)
price = sum(pvs)
periods = sum(t * pv for t, pv in enumerate(pvs, start=1)) / price
return periods / freq
print(round(macaulay_duration(100, 0.05, 0.04, 3), 4))
print(round(macaulay_duration(100, 0.00, 0.04, 5), 4))
print(round(macaulay_duration(100, 0.05, 0.04, 3, freq=2), 4))The first line prints 2.8615, matching the table. The second line is a 5-year zero-coupon bond and prints 5.0. The third line prices the same bond with semiannual coupons. Its result is slightly lower than 2.8615, because half of each year's coupon now arrives six months earlier.
Reading the result
Zero-coupon bonds
A zero-coupon bond pays everything at maturity, so its single cash flow has a weight of 1. Its Macaulay duration equals its maturity. This is the upper bound for a bond with positive coupons and the same maturity.
Coupon bonds
Any coupon pays some value before maturity, so the duration of a coupon bond is always less than its maturity. The larger the coupon, the more weight shifts to early dates and the lower the duration.
Perpetuities
A bond with no maturity still has a finite duration. For a perpetuity with yield y, the duration is (1 + y) / y. At 4% that is 26 years. Cash flows far in the future are discounted so heavily that they add little weight.
Common errors
- Forgetting to convert periods to years. For a semiannual bond, the sum of
t × weightis in half-years. Divide by 2. The exam often gives the periodic result and expects the annual one. - Using the coupon rate as the discount rate. Weights come from present values at the YTM per period. Using the coupon rate gives weights that do not describe the bond's market price.
- Using face value or cash-flow weights. Weighting by undiscounted cash flows overstates how much of the value arrives at maturity. This gives a duration that is too high.
- Dividing the annual yield by the wrong number. The periodic yield is YTM divided by
freq. A 4% annual yield is 2% per period for semiannual pay. - Treating the par-bond shortcut as general. Closed-form duration formulas exist, but they depend on assumptions such as coupon date alignment. Without those assumptions, compute the weighted sum directly.
Why the weighted average matters
Duration summarizes the timing of cash flows in one number. Two bonds can have the same maturity and very different durations. A 10-year zero-coupon bond has a duration of 10. A 10-year bond with a 6% coupon has a much lower one.
Duration also connects to risk. Cash flows far in the future are discounted over more periods. A change in yield changes their present value more than it changes the present value of near-term payments. A bond whose value sits further out in time will therefore move more when yields change. Modified duration turns this idea into a percentage.
Check your understanding
Exercise
A 2-year bond pays a 6% annual coupon on a par value of 100 and has a YTM of 5%. Compute its Macaulay duration. Is it above or below 2, and why?
Show answer
Discount at 5%. The year-1 cash flow is 6, with PV 6 / 1.05 = 5.7143. The year-2 cash flow is 106, with PV 106 / 1.1025 = 96.1451. The price is 101.8594. The weights are 5.7143 / 101.8594 = 0.0561 and 96.1451 / 101.8594 = 0.9439. Duration = 1 × 0.0561 + 2 × 0.9439 = 1.9439 years. It is below 2 because the year-1 coupon pays part of the bond's value before maturity, so the weighted average time is less than the maturity.
Exercise
A 5-year zero-coupon bond and a 5-year bond with a 7% annual coupon have the same YTM. Which has the higher Macaulay duration, and what is the duration of the zero?
Show answer
The zero-coupon bond has the higher duration. Its only cash flow is at year 5, so its duration is 5.0 years. The coupon bond pays part of its value earlier, so its duration is below 5.