Skip to content
All library documents

Estimating an Affine Nelson–Siegel Yield Curve with a Kalman Filter

Article Quant Q&A · Author: frank

Summary

The document outlines a state-space formulation for an arbitrage-free affine extension of the Nelson–Siegel term-structure model. Yield observations are represented as a maturity-dependent adjustment plus a linear combination of three latent factors and measurement noise. The factors evolve according to a discrete-time transition equation involving a mean-reversion matrix and long-run level, with process noise; a Kalman filter is proposed for estimation.

It also presents a lengthy analytical adjustment term intended to account for the model’s no-arbitrage restrictions, with coefficients formed from state-variable volatilities and covariances. The post is a request for help implementing the equations in R, rather than a worked implementation or reported empirical study. Its displayed expressions contain apparent notation or transcription inconsistencies, so they require verification against the cited paper before coding or estimation.

Key ideas

  • The model expresses yields as a maturity adjustment plus three latent Nelson–Siegel factors.
  • A state transition equation describes factor dynamics and includes mean reversion and process noise.
  • A Kalman filter is proposed to estimate the state-space system.
  • The no-arbitrage adjustment depends on parameters derived from factor volatilities and covariances.
  • The equations are not implemented or empirically validated in the document and should be checked against the source paper.

Tags

Full text
# state space for affine yield curve


# state space for affine yield curve












i would like to reproduce in R the working paper " Affine free arbitrage class of Nelson Siegel term structure". The authors considering the equation of nelson siegel plus an adjustment term(C(t,T)) fits and estimates a state space form of this equations with Kalman filter. The measurement equations is :$y_{t}=A+BX{t}+\epsilon_{t}$ and state equation is $ X_{t} = (I - exp(-K^{p} \Delta t))\theta^{p} + exp(-K^{P} \Delta t)X_{t-1} + \eta_{t}$; where $K^p$ is a matrix 3x3 of parameters to estimate and $\theta$ is a vector Nx1 of parameters to estimate. A is a vector Nx1 of adjustment term of this form: (where $\tau$ is the maturity) \begin{bmatrix} \frac{C_t}{\tau_1} \\ \vdots \\ \frac{C_N}{\tau_n} \end{bmatrix} and B is the coefficients matrix Nx3 of state variables: \begin{bmatrix} 1 & \frac{1-e^{-\lambda \tau_1}}{\lambda \tau_1} & \frac{1-e^{-\lambda \tau_1}}{\lambda \tau_1}-e^{-\lambda \tau_1} \\ \vdots & \vdots& \vdots \\ 1 & \frac{1-e^{-\lambda \tau_N}}{\lambda \tau_N} & \frac{1-e^{-\lambda \tau_N}}{\lambda \tau_1}-e^{-\lambda \tau_N} \end{bmatrix}and X is the vector of state variables: \begin{bmatrix} X{^1}{_t} \\ X{^2}{_t} \\ X{^3}{_t} \end{bmatrix}

furthermore the adjustment term C(t,T) has this analytical form: $= a \biggr[\frac{(T-t)^2}{6}\biggr] + b \biggr[\frac{1}{2 \lambda^2} - \frac{1}{\lambda^3} \frac{1-e^{-\lambda(T-t)}}{T-t)}+\frac{1}{4{\lambda^3}}\frac{1-e{-2\lambda(T-t)}}{T-t}\biggr] $

$ + c \biggr[\frac{1}{2\lambda^2}+\frac{1}{\lambda^2}*e^ {-\lambda (T-t) } - \frac{1}{4 \lambda} (T-t) e^{-2\lambda(T-t)} - \frac{3}{4 \lambda^2}e^{-2\lambda(T-t)}-\frac{2}{\lambda^3} \frac{1-e^{-\lambda (T-t)}}{(T-t)} + \frac{5}{8\lambda^3} \frac{1-e^{-2\lambda(T-t)}}{T-t)}\biggr] + $

$ + d \biggr[\frac{1}{2\lambda}(T-t)+\frac{1}{\lambda^2} e^{-\lambda(T-t)} - \frac{1}{\lambda^3} \frac{1-e^{-\lambda(T-t)}}{(T-t)}\biggr] $

$ +e\biggr[\frac{3}{\lambda^2} e^{-\lambda(T-t)} + \frac{1}{2\lambda}(T-t)+\frac{1}{\lambda}(T-t) e^{-\lambda(Y-t)} - \frac{3}{\lambda^3}\frac{1-e^{-\lambda(T-t)}}{(T-t)}\biggr] $

$ +f \biggr[\frac{1}{\lambda^2}+\frac{1}{\lambda^2} e^{-\lambda(t-t)} - \frac{1}{2\lambda^2}e^{-2\lambda(T-t)} -\frac{1-e^{-\lambda(T-t)}}{(T-t)} + \frac{1}{4{\lambda^3}}\frac{1-e{-2\lambda(T-t)}}{T-t}\biggr] $

where

$a=\sigma{^2_{11}}+\sigma{^2_{12}+\sigma{^2}_{13}}$;$b=\sigma{^2_{22}}+\sigma{^2_{21}+\sigma{^2}_{23}}$,

$c=\sigma{^2_{31}}+\sigma{^2_{32}+\sigma{^2}_{33}}$

$d=\sigma_{11} \sigma_{21}+\sigma_{12}\sigma_{22}+\sigma_{13}\sigma_{23}$;

$e=\sigma_{11} \sigma_{31}+\sigma_{12}\sigma_{32}+\sigma_{13}\sigma_{33}$;

$f=\sigma_{21} \sigma_{31}+\sigma_{22}\sigma_{32}+\sigma_{23}\sigma_{33}$;

the value of $\sigma_{ii}$ and ($\sigma_{ij}$) are unknown and they are respectively the volatility and correlation of state variables.

thank you for your time.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.