In this post we make an important change in our definition of the “best yield curve.” In this post we change the definition of “best” to be the yield curve with “maximum smoothness,” which we define mathematically. Given the other constraints we impose for realism, we find that this definition of “best” implies that yield curve should be formed from a series of cubic polynomials. We then turn to Example F, in which we apply cubic splines to yields and derive the related forward rates. We compare the result to Example E, the quadratic spline of forward rates, and we draw some interesting conclusions. We then lay out our plans for Part 9 in the series, a cubic spline of forward curves.

**Sample Data for the Basic Building Blocks of Yield Curve Smoothing**

As usual, 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. We continue to fit this raw data with our derived “best” yield curve.

**Example F: Cubic Yield Splines and Related Forwards**

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 define our criterion for best and specify what constraints we impose on the “best” technique to fit our desired trade-off between simplicity and realism. We again answer the nine questions posed in Part 2 of this series. We make three modifications versus part 7, quadratic splines of forward rates—we make the object of the smoothing exercise yields, we make the criterion for “best” maximum smoothness, and we for the first time insist that the curves be twice differentiable over the full length of the curve.

Step 1: Should the smoothed curves fit the observable data exactly?

1a. Yes

1b. No

**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

**2a. Zero coupon yields** is our choice for Example F. 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. Maximum smoothness.** For the first time, we choose maximum smoothness as an intuitive criterion for best, since in past installments 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 yield curve. In order to evaluation z over the full maturity spectrum of the yield curve, the yield segments must be 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.

**Step 4: Is the curve constrained to be continuous?**

4a. Yes

4b. No

**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

5b. No

**5a. Yes.** 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

6b. No

**6a. Yes.** For the first time, we insist that the yield 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 yield curve segments will join in a visibly smooth way at the knot points.

**Step 7: Is the curve thrice differentiable?**

7a. Yes

7b. No

**7b. No.** We do not need to specify this constraint as yet.

**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.

8c. No

**8b. Yes. ** For the first time, we find it necessary to constrain the yield curve at its left hand side in order to derive a unique set of coefficients for each segment of the yield curve. In part 9 of our series on yield curve smoothing building blocks, we will compare results using both answers 8a and 8b and reach conclusions about which is “best” for the sample data we are analyzing.

**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.

9c. No

**9a. Yes. **As in question 8, our other constraints and our definition of “best” put us in a position where the parameters of the best yield 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” yield curve. We explore choice 9b in part 9 of this series. The constraint here is imposed on the yield curve, not the forward rate curve.

Now that all of these choices have been made, both the functional form of the line segments for yields and the parameters that are consistent with the data can be explicitly derived from our sample data.

Deriving the Form of the Yield Curve Implied by Example F 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 yield curve segments to produce the same yield values, (b) the same first derivatives of yields, and (c) the same second derivatives of yields.

That means that we need to step up to a functional form for each yield 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 D:

http://en.wikipedia.org/wiki/Spline_interpolation

http://en.wikipedia.org/wiki/Spline_%28mathematics%29

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 no question which mathematical function is the best: it is a spline of cubic polynomials. This can be proven using the calculus of variations, as was done in the case of maximum smoothness forward rates in a proof contributed by Oldrich Vasicek, reproduced in Chapter 8 of van Deventer, Imai and Mesler, *Advanced Financial Risk Management *(John Wiley & Sons, 2004), in the appendix to Chapter 8. As is the case throughout the series, we are not asserting that a function form is best like advocates of the Nelson-Siegel approach. Instead, we are defining “best” mathematically, imposing constraints that are essential to realism in financial applications and DERIVING the fact that, in Example F, it is the cubic spline that is “best.”

As in prior examples where we measured “tension” or length, we can measure the smoothness of a yield curve in two ways. First, we could explicitly evaluate the integral that defines the smoothness statistic z since our constraints for Example F will result in a yield 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.

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 maximum smoothness yield curve.

Each yield 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 10 constraints require the yield curve to be equal to the observable values of y at either the left or right hand side of that segment of the yield curve, so for each of the 5 segments there are two constraints like this where y* denotes observable data:

In addition we have four constraints that require the first derivatives of the yield curve segments to be equal at the four interior knot points:

at the interior knot points. We rearrange these four constraints so that there is zero on the right hand side of the equation:

At each of these knot points, the second derivatives must also be equal:

When we solve for the coefficients, we will rearrange these four constraints in this manner:

So far, we have 18 constraints to solve for 5×4=20 coefficients. Our 19th constraint was imposed in our answer to question 8, where we required that the second derivative of the yield curve was zero when maturity t_{j }is zero or some other value x_{1}:

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. We will discuss in later blogs the alternative specifications, but for now assume we want to constrain the first derivative of the yield curve at t_{j+1}=10 to take a specific value x_{2}, a value commonly selected to be zero:

Our initial implementation will use x_{1} and x_{2}=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 yield curve. We use the fourth relationship below to derive the forward rate curve implied by the derived coefficients for the yield curve:

We can now plot the yield and forward rate curves to see whether or not our definition of “best yield curve” and the related constraints we imposed have produced a realistic yield curve and forward rate curve:

Here in Example F, the yield curve itself fits the data perfectly, our standard “necessary” condition. The yield curve is extremely smooth given the variations in it that are required by observable yields, noted as black dots. The forward rate curve is also reasonably smooth but it shows some more dramatic movements than expected. Is it possible to do even better by optimizing the discrete smoothness statistic by changing x_{1 }and x_{2 }in our 19^{th} and 20^{th} constraints? Yes.

Before doing that, however, we overlay the yield and forward curves on the best fitting (but not perfectly fitting) Nelson-Siegel curve:

As we’ve noted before, the Nelson-Siegel curves are simply wrong and do not pass through the actual data points (in black). As in Example E, the cubic spline of yields is both more accurate and (literally) easier to calculate than Nelson-Siegel. We derive the “best” forward rate and yield curve with one matrix inversion. Nelson-Siegel requires the ability to optimize a non-linear function and, even after that optimization, doesn’t meet the minimum standard of consistency with observable market data.

Nonetheless, we can potentially do better with the cubic yield spline. Let’s again ask the question “Can we improve the cubic spline approach by optimizing the value of x_{1} and x_{2} in the 19th and 20th constraints to lower the discrete measure of smoothness z?” 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 x_{1}=x_{2}=0. We now look at alternative values for x_{1} and x_{2}.

There are two criteria for “best” that we could use given our statement above that the “best” curve is the one that is the smoothest. We could choose the values of x_{1} and x_{2} that produce the smoothest yield curve or the values of x_{1} and x_{2} that produce the smoothest forward rate curve. We do both, as before.

If we use common spreadsheet software and iterate x_{1} and x_{2} so that the smoothness statistic z (calculated numerically at 120 monthly intervals) of the yield curve is minimized, we get this set of coefficients:

If we iterate x_{1} and x_{2} so that the smoothness statistic z of the forward rate curve is minimized, we get still another set of coefficients:

The smoothest yield curve is produced by x_{1}=0.00129 and x_{2}=0.00533. The smoothest forward rate curve is produced by x_{1}=-0.08419 and x_{2}=0.00811. We can compare these three variations on the yield curve produced by the cubic spline approach:

The graphs make it clear that alternative assumptions about the slope of the yield curve at the right hand side of the graph have a much more important impact on the shape of the yield curve than the left hand side constraints, which is to be expected because the two right most actual yields are five years apart and the two left most actual yields are only 0.25 years apart. The next graph shows the impact on forward rates:

The forward curve with the maximum smoothness, consistent with a cubic spline of yields, is shown in blue. It slopes sharply upward on the right hand side of the graph. The curve in orange produces the smoothest yield curve, and the curve in red is consistent with the first derivative of the yield being zero at T=10 and the second derivative of the yield curve being zero at t=0. The dramatic differences in these curves show that we would be better served smoothing forwards directly and imposing realistic constraints on forward rates, not yields. We turn to that in Part 9 of this series.

The table below summarizes the smoothness and length of forward curves and yield curves for each of the alternative smoothing methods we have explored so far. We rank the methods from best to worst by the smoothness of the forward curve:

By optimizing x_{1} and x_{2 }in our 19^{th} and 20^{th} constraints, we reduced the smoothness z of the forward rate curve from 5,038.87 to 4,564.23. This smoothness measure is about 80% less than the smoothness of using linear forwards that we explored in Example C. Still, the wide swings in forward rates that stem from cubic yields are a matter of some concern. That concern is highlighted when we compare forward curves for Examples E and F:

The graph shows our Example F forward curve, where we have optimized the cubic yield spline by adjusting x_{1} and x_{2} for the smoothest forward curve. The curve from Example F is compared with the shortest forward curve that can be derived using a quadratic spline of forwards in Example E. Since the quadratic forward rate curve is a special case of a cubic spline of forwards, this graph gives us confidence that we can dramatically increase the smoothness and shorten the length of forward curves if we apply a cubic spline directly to forwards, not to yields

In part 9 of this blog, we do exactly that.

Donald R. van Deventer

Kamakura Corporation

Honolulu, December 8, 2009