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})
%}
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;
}
}
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.