Nelson Siegel Svansson

버전 1.0.1 (3.69 KB) 작성자: Gregor Fabjan
Popular way to model the yield curve called Nelson-Siegel-Svannson algorithm
다운로드 수: 267
업데이트 날짜: 2022/9/19

📚 Nelson-Siegel-Svannson algorithm 📚


Popular algorithm for fitting a yield curve to obseved data.

Problem

Data on bond yields is usualy avalible only for a small set of maturities, while the user is normaly interested in a wider range of yields.

Solution

A popular solution is to use an algorithm to find a function that fits the existing datapoints. This way, the function can be used to interpolate/extrapolate any other point. The Nelson-Siegel-Svannson model is a curve-fitting-algorithm that is flexible enough to approximate most real world applications.

The Nelson-Siegel-Svensson is an extension of the 4-parameter Nelson-Siegel method to 6 parameters. The Scennson introduced two extra parameters to better fit the variety of shapes of either the instantaneous forward rate or yield curves that are observed in practice.

Advantages:

  • It produces a smooth and well behaved forward rate curve.
  • The intuitive explanation of the parameters. beta0 is the long term interest rate and beta0+beta1 is the instantaneous short-term rate.

To find the optimal value of the parameters, the Nelder-Mead simplex algorithm is used (Already implemented in Matlab's fminsearch function). The link to the optimization algorithm is Gao, F. and Han, L. Implementing the Nelder-Mead simplex algorithm with adaptive parameters. 2012. Computational Optimization and Applications. 51:1, pp. 259-277.

The furmula for the yield curve (Value of the yield for a maturity at time 't') is given by the formula:

formula + formula formula + formula formula + formula formula

Parameters

  • Observed yield rates YieldVec.
  • Maturity of each observed yield TimeVec.
  • Initial guess for parameters beta0, beta1, beta2, beta3, labda0, and lambda1.
  • Target maturities TimeResultVec.

Desired output

  • Calculated yield rates for maturities of interest TimeResultVec.

Getting started

The user is interested in the projected yield for government bonds with a maturity in 1,2,5,10,25,30, and 31 years. They have data on government bonds maturing in 1,2,5,10, and 25 years. The calculated yield for those bonds are 0.39%, 0.61%, 1.66%, 2.58%, and 3.32%.

TimeVec = [1; 2; 5; 10; 25];
YieldVec = [0.0039; 0.0061; 0.0166; 0.0258; 0.0332];
beta0   = 0.1; % initial guess
beta1   = 0.1; % initial guess
beta2   = 0.1; % initial guess
beta3   = 0.1; % initial guess
lambda0 = 1;   % initial guess
lambda1 = 1;   % initial guess

TimeResultVec = [1; 2; 5; 10; 25; 30; 31]; % Maturities for yields that we are interested in

%% Implementation
OptiParam = NSSMinimize(beta0, beta1, beta2, beta3, lambda0, lambda1, TimeVec, YieldVec); % The Nelder-Mead simplex algorithem is used to find the parameters that result in a curve with the minimum residuals compared to the market data.
disp("Optimal parameters are")
disp(OptiParam)

ResultYield = NelsonSiegelSvansson(TimeResultVec, OptiParam(1), OptiParam(2), OptiParam(3), OptiParam(4), OptiParam(5), OptiParam(6)); % Calculate the yield for tergeted maturities using the calibrated partameters

인용 양식

Gregor Fabjan (2024). Nelson Siegel Svansson (https://github.com/qnity/nelson_siegel_svansson_matlab), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2022a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.0.1

Project now has a website

1.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.