# Nelson-Siegel Yield Curve Model

(Yield curves are obtained by bootstrapping the interest rate information contained in a range of risk-free/ near risk-free fixed income instruments (deposit rate, LIBOR, FRA, interest rate futures, interest rates wap, OIS swap, government bond…).  Rather than treating each data point as separate, many are more interested in the term structure of the yield curve. Nelson-Siegel (and its extension Nelson-Seigel-Svensson) exponential components framework is one of the most popular yield curve models.  The forward rates are readily available once a Nelson-Siegel model is obtained.  As shown by Diebold & Li, the three time-varying components in Nelson-Siegel can be interpreted as factors corresponding to level, slope and curvature.   These factors have also been shown by Diebold & Li to have some forecasting power. We will go through the meaning of various components of Nelson-Siegelmodel, its implementation and other alternatives in yield curve modelling. `

### Yield curve, discount curve and forward curve

Suppose we have a basket of zero-coupon risk-free bonds with different maturities. Let D(t) be the discount factor calculated as the present value of a zero-coupon bond with a notional value of \$1 that matures at time t, z(t) be the continuously compounded nominal yield to maturity of that zero-coupon bond (spot/zero rate), f(t1,t2) be the forward rate with f(t,t) be the instantaneous forward rate. The relationship between zero rate, discount factor and forward rate can be expressed as follows.
$D(t)=exp(-t*z(t)) \\ f(t,t)=-D'(t)/D(t) \\ f(t_1,t_2)=\frac{1}{t_2-t_1} \int_{t_1}^{t_2} f(u,u) du \\ z(t)=f(0,t)$

### Instruments Used to Build Yield Curve

Yield curve represents the risk-free rate of a particular currency for a particular economy.   The definition is risk-free is in the eye of the beholder.   Judging from the instruments a yield curve is built upon, there are three main types of yield curves:

• LIBOR based: assume the counterparty risk amongst major bank is negligible
• OIS based: mitigate counterparty risk by collateral posting and the use of overnight swap
• Government bond based: as risk-free (or risky) as the bond of a particular government)

LIBOR based curve: These were the preferred curves when investment banks pricing derivatives in the pre-2008 world.   LIBOR rates are available for major currencies with tenors under one year. Interest rate swaps (IRS) are being used for tenors beyond one year.   As the LIBOR rate is the same as the zero rate, the conversion from that to discount factor is straightforward for the shorter end of the curve.

In the case of interest rate swap (IRS), the par swap rate (s) is available.  As it is not the same as the zero rate, an iterative procedure commonly known as bootstrapping is used to derive the discount rate. In more details, the fixed leg of an IRS up to ti is $s \sum_{j=1}^i D(t_j)*(t_j-t_{j-1})$. The floating leg up to ti is $1-D(t_i)$.  If all the discount factors below D(ti) are known, solving the following equation iteratively will give the discount factor: $D(t_i) = \frac{1-s \sum_{j=1}^{i-1} (t_j-t_{j-1}) D(t_j)} {1+s (t_i-t_{i-1})}$
The calculation is more complicated in practice. Let’s say we have the full yield curve from 0-1 year thru the LIBOR rates and the next liquid instrument is 2-year IRS and we want to solve for a discount rate every six months.  We need to solve for the discount factor of both D(1.5Y) and D(2.0Y) simultaneously.   The bootstrapping equation above needs to be modified.   Usually, an assumption is being made upon the forward rates (e.g. forward rate at 1.5Y = that at 2.0Y) when solving for the bootstrapping formula.

OIS based curve: Overnight Indexed Swap (OIS) is as an instrument considered nearest to risk-free. One side of the trade pays a fixed rate and receives the overnight index rate (which can be Fed Funds Rate or SOFR for USD or Eonia for EUR). The return is calculated as the accumulated difference between the fixed rate and overnight index rate across a period of time.   No principal changes hands and the mark-to-market P&L is collateralised to minimise the counterparty risk. A yield curve can be built from the family of OIS products.   The calculation is similar to that of LIBOR based curve. The bankruptcy of Lehman Brothers serves as a constant reminder that counterparty risk exists even when trading with systemically important global banks.  Before the crisis, OIS was about the same as LIBOR. As expected, LIBOR was substantially higher than OIS during the 2008 financial crisis and the spread never falls back to pre-crisis level after 2008.  As OIS based yield curve is closer to risk-free than LIBOR based yield curve, OIS discounting is deemed the more suitable curve to price collateralised derivatives deals.

Government Bond based curve: The sovereign yield curves are monitored by national central banks as part of their regular market surveillance operations.   The market prices of the outstanding government bonds are used as the inputs when building the yield curves.

Government bonds can be less standardised when compared with swap-based products we come across in previous cases.  First of all, most outstanding government bonds carry fixed coupon and can trade far away from par (in contrast to par swap rate).  Also, the time to maturity does not fall neatly to a round number of months or years.  These make a bootstrapping formula more difficult to be derived.

While it is possible to formulate the yield curve construction process as a high dimension non-linear optimisation problem, it is undesirable.  For example, if the goal is to find a list of discount factors that minimises the squared sum of price or yield error between actual and theoretical bond prices,  each discount factor would add an extra degree of freedom. So semi-annual update for a 30-year yield curve would be 60-degree in dimension.  Such an optimisation problem is prompt to numerical errors. It is desired to fit the yield curve to either a parametric or spline-based yield curve models of much lower dimension.

### Parametric vs Spline-based Models

Nelson-Siegel and its variant Nelson-Seigel-Svensson are leading parametric models, widely adopted by central banks in EU whereas Canadian, Japanese, British and USA central banks prefer spline-based models [BIS].  We briefly review spline-based models before coming back to our main topic of Nelson-Siegel type parametric models.

The spline-based models employed by the central banks are different from general-purpose cubic splines.   Many are derived from the work of [Fisher, Nychka and Zervos] on “smoothing splines”.  Starting from an over-parameterised model with many knot points, the model is streamlined by removing redundant knot points based upon the ratio of a goodness-of-fit measure to the number of parameters. The spline-based models are more flexible than parametric models as more knots can be incorporated when the shape of the yield curve happens to be more complicated.  However, spline-based models are not as intuitive as Nelson-Siegel type of model when trying to visualise the term structure from the parameters.

### Nelson-Siegel and Nelson-Seigel-Svensson

Nelson-Siegel (NS) is an exponential component model with four parameters.  It has three exponential components (coefficient β0, β1, β2) and the time variable is scaled with an extra parameter, τ.  The first term represents a long-term interest rate, the second term is a time decay component (can slope upwards or downwards, dependent on the sign of the coefficient), and the third term is a hump (can be a peak or trough, dependent on the sign of the coefficient).  The time parameter tau controls the location of the hump.   Nelson-Seigel-Svensson (NSS) has an extra term resembles the third term of NS. It represents a second hump at a different part of the yield curve.  Two extra parameters (β3 and τ2) are thus introduced.

Forward rate of the NSS model (in the case of NS, β3=0)
$f(t,t)=\beta_0+\beta_1 \exp{(-t/\tau_1)}+\beta_2 \frac{t}{\tau_1} \exp{(-t/\tau_1)}+\beta_3 \frac{t}{\tau_2} \exp{(-t/\tau_2)}$

Zero rate of the NSS model (in the case of NS, β3=0)
$z(t)=\beta_0+\beta_1 \frac{1-\exp{(-t/\tau_1)}}{t/\tau_1} + \beta_2 \left( \frac{1-\exp{(-t/\tau_1)}}{t/\tau_1} - exp{(-t/\tau_1)} \right) + \beta_3 \left( \frac{1-\exp{(-t/\tau_2)}}{t/\tau_2} - exp{(-t/\tau_2)} \right)$

### Fitting the parameters to NS and NSS model

While the dimension (4 for NS and 6 for NSS) is not too high for a non-linear optimisation algorithm, a simpler and more robust solution is still preferred.  We observe that the NS and NSS zero rate formula is linear once if the time parameter, τ (or τ1, τ2 in the case NSS) is fixed.  As illustrated in the Nelson-Siegel’s original paper, grid-based OLS can be an efficient solution when fitting parameters to an NS Model.  In the case of an NS model, we first fix the parameter τ and run OLS to solve for the rest of the parameters β02.   Then we repeat the calculation for a range of τ.   Since τ defines the location of the “hump”, valid τ value would be between zero to the longest tenor of interest (say 30 years). The set of parameters that maximise the R2 between the calculated and actual zero rates would be the solution for the grid-based search.   The search procedure is similar for NSS model. Since NSS has two time-related parameters τ1 and τ2, we need to search a 2D grid.   As data is more frequent for the shorter tenor (less than 1 year, I find simple OLS places too much emphasis on the shorter end of the curve.  Instead, a weighted OLS scheme with weight proportional to the difference between the tenor of the neighbouring data point is employed.

A grid search solution for both NS and NSS model has been implemented in python.   The source code can be downloaded from here.   As an example, we fit the models to the AAA Eurozone government bonds for 11/11/2019.

### Term Structure and NS Model Parameters

As illustrated by [Diebold and Li], the parameters β0, β1 and β2 are closely related to the long-term rate, slope and curvature respectively.  We represent the long-term rate by the 30-year rate, slope by 30-year minus 3-month rate, curvature by 2*5-year minus the sum of 3-month and 30-year and plot these alongside with β0, -β1 and 0.25β2 and plot them against each other for US yield curves between 2004 to 2019.  We can see beta0 and beta1 describes the long term rate and slope quite well.  Beta3 roughly tracks the curvature but the fit is not very good.  It could be related to the fact that the curvature formula is just an approximation.  The ratio between the wing and head portion of the butterfly trade is likely to change consider the large fluctuation in rates in the last 15 ye