Yield Curve - Nelson Siegel

Overview

Nelson and Siegel proposed a simple formula that is capable of fitting various forms of the yield curve. It can be used to provide interpolations between periods on the curve, as well as to decompose movements of the curve to a small set of factors.

Yield Curve Formula

The Nelson Siegel Model assumes the following functional form for the zero coupon rates
{% r(t) = \beta_0 + \beta_1 \frac{1 - e^{t/\tau}}{t/\tau} + \beta_2 (\frac{1-e^{t/\tau}}{t/\tau} - e^{t/\tau}) %}
  • level - labeled as {% \beta_0 %} above
  • slope - labeled as {% \beta_1 %} above
  • shape - labeled as {% \beta_2 %} above
  • decay - labeled as {% \tau %}, sometimes the formula is written with {% \lambda = \frac{1}{\tau} %} above

Implementation

The following code implements the Nelson Siegel function. It is coded as a function that takes the given parameters and returns a function of time, which can be used to chart the curve.

let getCurve = function(level, slope, shape, decay,t){ return function(t){ let factor1 = level; let factor2 = slope * (1 - Math.exp(-1*t/decay))/(t/decay) let factor3 = shape * ((1 - Math.exp(-1*t/decay))/(t/decay)-Math.exp(-1*t/decay)) return factor1+factor2+factor3; } }

Nelson Siegel Curve

This code demonstrates creating a function that computes Nelson Siegel type curve.

Chart of Nelson Siegel Curve

The following demonstrates the relationship between a Nelson Siegel curve to the four parameters used to create the curve. Moving the slider controls will change each given parameter.

Fitting to Data

The Nelson Siegel model is nonlinear, and hence cannot be estimated using a linear regression. The typical way to fit the paramters to data is to use some form of numeric optimization.

For an example demonstration of fitting the curve, please see fitting a yield curve

Additional Applications

  • Risk - the Nelson Siegel parameters can be used as a risk model when an underlying statist distribution is assigned to each.
  • Forecasting and Trading - the parameters also provide in reasonable way to look at the trends in the shape of the curve.

Nelson Siegel API

The davinci library hosts the nelson-siegel api which can be used to build and fit curves.

Video Demo

Nelson Siegel