Sample Data for the Basic Building Blocks of Yield Curve Smoothing
Again, we continue to insist in this section of our series that any smoothing technique that does not fit the market exactly is unacceptable for practical use (such as the flawed Nelson-Siegel approach). We continue to fit this raw data with our derived “best” yield curve.
Example G: Cubic Forward Rates and Related Yields
As always, “yields” are always meant to be continuously compounded zero coupon bond yields and “forwards” are the continuous forward rates that are consistent with the yield curve. We try to continue the same process used through this series, but we make a mistake: normally we define our criterion for “best curve” and specify what constraints we impose on the “best” technique to fit our desired trade-off between simplicity and realism. We then answer the nine questions first posed in Part 2 of this series. We make one mistake versus part 8 in this series, the cubic spline of yields—we make the object of the smoothing exercise forward rates, on the hope that a cubic that produces maximum smoothness yields will produce maximum smoothness forwards—we show that the hope was just a hope, and that a cubic spline of forward rates is (a) not maximum smoothness and (b) can be horribly unrealistic. We continue to insist that the curves be twice differentiable over the full length of the curve. This allows us to use the insights of Janosi and Jarrow (2002) to optimize key parameters to derive the maximum smoothness and minimum length forward rate curves. It turns out that minimizing length is a useful “insurance policy” that minimizes the damage from inadvertently applying bad choices (a cubic spline) to forward rate smoothing. Here are the answers to our normal 9 questions:
Step 1: Should the smoothed curves fit the observable data exactly?
1a. Yes. Our answer is unchanged.
Step 2: Select the element of the yield curve and related curves for analysis
2a. Zero coupon yields
2b. Forward rates
2c. Continuous credit spreads
2d. Forward continuous credit spreads
2b. Forward rates is the choice for Example G. We continue to observe that we would never choose 2a or 2b to smooth a curve where the underlying securities issuer is subject to default risk. In that case, we would make the choices in either 2c or 2d. We do that later in this series.
Step 3: Define “best curve” in explicit mathematical terms
3a. Maximum smoothness
3b. Minimum length of curve
3c. Hybrid approach
3a. Both Maximum smoothness and minimum length. For the first time, we choose both maximum smoothness and minimum length as criterion for best. As noted in part 8 of this series, we have critiqued the results from some assumptions because of the lack of smoothness in either yields, forward rates, or both. Smoothness is defined as the variable z such that
In this case, the function g(s) is defined as the forward rate curve. In order to evaluate z over the full maturity spectrum of the forward curve, the forward rate segments must be at least twice differentiable at each point, including the knot points. We want to minimize z over the full length of the yield curve. Our answers in Steps 4-6 make the analytical valuation of s possible just as when we evaluated length in example D. In part 10 of this series, we examine the implications of requiring that the function be thrice differentiable at every point, a subtle but hugely important extension. In this Example G, we insist only that the curve be twice differentiable, on the hope (which turns out to be wrong) that the resulting forward rate curve will be the “maximum smoothness” forward curve subject to that constraint and the other constraints that we impose. We show in Part 10 that the true maximum smoothness forward curve is not in fact a cubic polynomial at all.
Step 4: Is the curve constrained to be continuous?
4b. Yes. As in Examples B and later, we insist on continuous yields and see what this implies for forward rates.
Step 5: Is the curve differentiable?
5a. Yes. Again, this is the change first imposed in Example D. We seek to take the spikes out of yields and forward rates by requiring that the first derivatives of two curve segments be equal at the knot point where they meet. This constraint also means that a linear “curve” isn’t sufficiently rich to satisfy the constraints we’ve imposed.
Step 6: Is the curve twice differentiable?
6a. Yes. As in part 8, where we applied this constraint to the yield segments, we now insist that the forward rate curve be twice differentiable everywhere along the curve, including the knot points. This would allow us to evaluate smoothness analytically if we wished to do so, and it insures that the forward rate curve segments will join in a visibly smooth way at the knot points.
Step 7: Is the curve thrice differentiable?
7b. No. We do not need to specify this constraint as yet. That is something we will explore in Part 10 of this series for reasons that will become obvious as we go forward with Part 9.
Step 8: At the spot date, time 0, is the curve constrained?
8a. Yes, the first derivative of the curve is set to zero or a non-zero value x.
8b. Yes, the second derivative of the curve is set to zero or a non-zero value y.
8a and 8b. Both approaches will be used and compared. Like example F in Part 8 of this series, we find it necessary to constrain the forward rate curve at its left hand side and right hand side in order to derive a unique set of coefficients for each segment of the forward rate curve. We compare results using both answers 8a and 8b and reach conclusions about which is “best” for the sample data we are analyzing. The answers to question 8 have a critical impact on the reasonableness of cubic splines for forward rates in a financial context. We learn in example G that we need to go one step beyond a cubic spline of forward rates to get the most reasonable answer.
Step 9: At the longest maturity for which the curve is derived, time T, is the curve constrained?
9a. Yes, the first derivative of the curve is set to zero or a non-zero value j at time T.
9b. Yes, the second derivative of the curve is set to zero or a non-zero value k at time T.
9a and 9b. Both approaches will be used and compared. Our other constraints and our definition of “best” for example G put us in a position where the parameters of the best forward rate curve are not unique without one more constraint. We impose this constraint to obtain unique coefficients and then optimize the parameter used in this constraint to achieve “the best” forward rate curve as suggested by Janosi and Jarrow (2002). The constraints here are imposed on the forward rate curve, not the yield curve. We will use both “maximum smoothness” and “minimum length” as criterion for best conditional on our choice of cubic curve segments and the other constraints we impose.
As mentioned above, we have deviated from our normal derivation and are assuming, incorrectly, that if the cubic spline of yields is “maximum smoothness” for yields, a cubic spline of forwards must be as well. We now proceed to prove that assumption to be incorrect.
Deriving the Form of the Forward Rate Curve Implied by Example G Assumptions
Our data set has observable yield data at maturities of 0, 0.25 years, 1, 3, 5 and 10 years. We have 6 knot points in total and 4 interior knot points (0.25, 1, 3, and 5) where we require (a) the adjacent forward rate curve segments to produce the same forward values, (b) the same first derivatives of forwards, and (c) the same second derivatives of forwards.
That means that we need to step up to a functional form for each forward rate curve segment that has more parameters than the quadratic segments we used in Examples D and E. The following two links to Wikipedia articles nicely summarize the progression from linear to quadratic to cubic splines, as we mentioned in Example F:
As it says in the first link, “Amongst all twice continuously differentiable functions, clamped and natural cubic splines yield the least oscillation about the function [g] which is interpolated.” From our definition of “best,” maximum smoothness, there is (in general) no question which mathematical function is the best: it is a spline of cubic polynomials as it was in the case of yield curve smoothing in Part 8. As mentioned in Part 8, this assertion can be proven using the calculus of variations, as was done in the case of maximum smoothness forward rates (thrice differentiable, as in Part 10 of this series). That proof was contributed by Oldrich Vasicek and reproduced in Chapter 8 of van Deventer, Imai and Mesler, Advanced Financial Risk Management (John Wiley & Sons, 2004), in the appendix to Chapter 8.
The problem that Example G reveals is that forward rates have a completely different (but mathematically related) set of mathematical constraints linking them to observable yield data than yields themselves. It turns out that, because of those differences, it NOT TRUE that the cubic spline that is the “best” approach to smoothing forward rates given the constraints that have been imposed. We prove this in part 10 of this series and plunge ahead blindly, applying cubic splines to forwards, on the vain hope that the results will be good.
As in Example F in Part 8 of this series, we can measure the smoothness of a forward rate curve in two ways. First, we could explicitly evaluate the integral that defines the smoothness statistic z since our constraints for Example G will result in a forward rate curve that is twice differentiable over its full length. The other alternative is to use a discrete approximation to evaluation of the integral. This is attractive because it allows us to calculate smoothness for the other examples in this series for which the relevant functions are not twice differentiable. For that reason, we use a discrete measure of smoothness at 1/12 year maturity intervals over the 120 months of the yield curve we derive. This is the same as in Example F in Part 8 of this series.
For any function x, the first difference between points i and i-1 is
The first derivative can be approximated by
The second derivative is
To evaluate smoothness numerically, we calculate the second derivative at 1/12 year intervals, square it, and sum over the full length of the yield curve. With this background out of the way, we now derive the forward rate curve that is consistent with the cubic spline approach.
Each forward rate curve segment has the cubic form
The subscript i refers to the segment number. The segment from 0 to 0.25 years is segment 1, the segment from 0.25 years to 1 year is segment 2, and so on. The first constraint requires the first forward rate curve segment to be equal to the observable value of y at time zero since y(0)=f(0).
where for this first constraint tj = 0. In addition we have four constraints that require the forward rate curves to be equal at the four interior knot points:
at the interior knot points. We rearrange these four constraints, for j=1,4 like this:
At each of these interior knot points, the first derivatives of the two forward rate segments that join at that point must be also be equal:
When we solve for the coefficients, we will rearrange these four constraints in this manner:
Next, we need to impose the constraint that the second derivatives of the joining forward rate curve segments are equal at each of the four interior knot points. This requires
As usual we rearrange this as follows:
So far, we have 1+4+4+4=13 constraints to solve for 5x4=20 coefficients. We have 5 more constraints that are similar to those used in Part 5 and Part 7 of this series:
Our 19th constraint was imposed in our answer to question 8, where we required either that the second derivative of the yield curve was zero when maturity tj is zero or some other value x1 or that the second derivative take on a zero value or other value x1. For purposes of this first example, we assume that it is the second derivative at time tj=0 that becomes 0. We alter these assumptions later.
Our last constraint is imposed by our answer to question 9 at the right hand side of the forward rate curve, time T=10 years. As above, for T=10, we can constrain the right hand side of the forward rate curve to have either a first derivative or second derivative equal to zero or some other value x2. For our first implementation of cubic forward rates, we want to constrain the first derivative of the forward rate curve at tj+1=10 to take a specific value x2, a value commonly selected to be zero:
Our initial implementation will use x1 and x2=0.
In matrix form, our constraints look like this:
Note that it is the last two elements of the “y Vector” matrix where we have set the constraints that the second derivative at time zero and the first derivative of the yield curve at 10 years be zero. When we invert the coefficient matrix, we get the following result:
We solve for the following coefficient values:
These coefficients give us the five cubic functions that make up the forward rate curve. We use the second and third relationships below to derive the yield curve implied by the derived coefficients for the forward rate curve:
The yield function for any segment j is
We note that y* denotes the observable value of y at the left hand side of the line segment where the maturity is tj. Within the segment, y is a quartic function of t, divided by t.
We can now plot the yield and forward rate curves to see whether or not our assumption that the “best forward rate curve” is a cubic spline and the related constraints we imposed have produced a realistic yield curve and forward rate curve. The results are very disappointing for the reasons that we have indicated earlier in this blog entry—the forward rate curve that we have generated is NOT the maximum smoothness forward rate curve that is consistent with the data. The results are highly volatile and produce negative forward rates:
Here in Example G, the yield curve itself fits the data perfectly, our standard “necessary” condition. The yield curve still looks reasonable given the variations in it that are required by observable yields, noted as black dots. It is the forward rate curve that is a serious problem that we will dramatically improve in Part 10 of this series. Within the cubic forward rate functions, however, we ask if it is possible to do better by optimizing the discrete smoothness statistic by changing x1 and x2 in our 19th and 20th constraints? The answer is “somewhat.”
This insight, as we said in Part 6 of our blog, comes from a working paper by Tibor Janosi and Robert A. Jarrow in 2002, who noted that these constraints and others like them can have important implications for the “best” curve. Our first implementation was x1=x2=0 for f”(0) and f’(10). We now look at alternative values for x1 and x2. We could also examine forward rate curves where we constrain f’(0) instead of f”(0) and f”(10) instead of f’(10). We leave that exercise to the reader.
For any values of x1 and x2, we have to decide what to optimize. There are two choices that we have discussed in this smoothing series, the curve that is the “maximum tension” or shortest length, and the curve that is the smoothest. In both cases, “shortest” or “smoothest” is conditional on the constraints that limit the nature of the curves, like the requirements that the curves be cubic and fit the actual data. In addition to this point, we could optimize with respect to either the forward rate curve or the yield curve. If we optimize smoothness with respect to both x1 and x2, we get a truly horrible result because the implied direction of the forward curve on the right hand side, rising sharply, is both terribly unrealistic and it drives forward rates even more negative in the middle of the curve, as shown in this graph:
For this reason, we realize that the requirement that the first derivative of the forward curve at the right hand side, t=10, should be set to zero so the forward curve levels off. We therefore set x2=0 and iterate values of x1 to get two “best” curves—the smoothest curve, subject to our constraints, and the shortest curve subject to our constraints. If we use common spreadsheet software and iterate x1 so that the smoothness statistic z (calculated numerically at 120 monthly intervals) of the forward curve is minimized, we get this set of coefficients:
The results, shown in the graph below, are more realistic on the right hand side of the forward rate curve, but the curve is very unrealistic because forward rates still turn negative. The reason for this is that we have chosen a polynomial form (cubic) and a set of constraints that are inconsistent with the smoothest forward rate curve, which we demonstrate in Part 10 of this series. Here’s what we get for the “cubic” forward rate curve which is the smoothest we can draw:
If we instead we iterate x1 so that the length of the forward rate curve is minimized, we get still another set of coefficients:
The yield curves and forward curves that are consistent with our constraints and our criterion for “best,” shortest length, look like this:
The results are much more reasonable, and we have eliminated the negative forward rates from the forward curve. One of the things that is most interesting about this result is that it is a fairly rare example of inconsistency between “maximum smoothness” and “minimum length.” A straight line between two points, for example, is both the maximum smoothness “curve” and the minimum length “curve.” In Part 10 of this series, we will see the consistency between these two concepts restored.
The final graph in our implementation of cubic forward rates compares the 3 forward rate curves we have derived:
Two of the three results are, frankly, terrible. What is particularly worrisome is that a cubic spline is a sophisticated choice of smoothing techniques and that these kinds of results can be a surprise to many. We fix this problem in Part 10 in our series, in which we produce the true “maximum smoothness” forward rate curve, an approach that restores the more normal consistency between maximum smoothness and minimum length curves.
The reason that these results are so terrible is that a cubic polynomial can only meet the constraints we’ve imposed with very high and low swings of the curve. We found exactly the same problem with the “minimum length” criterion for best using linear forward rates—we got a very “spikey” forward curve with a wild saw tooth pattern because the linear form (derived because we didn’t require the “curves” to have equal first and second derivatives at the knot points) didn’t allow the “minimum length” criterion to work well. As we’ll see in part 10, requiring that the curves have equal third derivatives at the knot points solves this problem for “maximum smoothness” as a criterion.
In the meantime, we have learned something else important—when one has made a bad choice of functional form (cubic) and constraints, imposing “minimum length” when iterating on key parameters is usually a good insurance policy. If one makes a good choice of functional form and constraints, this insurance policy is unnecessary.
Donald R. van Deventer
Honolulu, December 30, 2009