luphord / nelson_siegel_svensson

Implementation of the Nelson-Siegel-Svensson interest rate curve model.
MIT License
110 stars 41 forks source link

Error in calibrate_nss_ols() parameter output comparing with Fed Data #9

Closed Hampton89 closed 2 years ago

Hampton89 commented 2 years ago

Description

Input: different tenors of US zero-coupon bond yield from Bloomberg I am trying to use calibrate_nss_ols() model to get the 6 parameters, and then I compare the parameters published by Fed Fed data source: https://www.federalreserve.gov/data/yield-curve-tables/feds200628_1.html But the result I get from the NSS model is a bit different from what Fed actually published

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

What I Did

I input about 10 points on the US zero-coupon curve from Bloomberg For example on 08/09/2015: calibrate_nss_ols(t= np.array([0.25, 0.5, 1,2,3, 5,7, 10, 20,30]), y = np.array([0.158, 0.224, 0.349, 0.719, 1.051, 1.552, 1.914, 2.216, 2.811, 3.182]))

For example on 27/10/2010: calibrate_nss_ols(t= np.array([0.25, 0.5, 1,2,3, 5,7, 10, 20,30]), y = np.array([0.114, 0.194, 0.231, 0.445, 0.673, 1.364, 2.143, 2.929, 4.197, 4.589]))

However, our result is a bit different from what Fed published: example on 2 dates:

image

Also, I tried to test the NSS parameters output from 2010 to today, by inputing the 10 points on zero coupon yield, most of the output parameters does not really match the parameters Fed published...

May I know what do you think could cause the error?

Thank you very much for your time and help!

Bests regards

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
luphord commented 2 years ago

I am afraid this is not going to work. You are trying to estimate 6 parameters from only 10 data points. Two of these parameters (tau1 and tau2) are determined by nonlinear optimization. Best thing you could try is to fix the values of tau1/2 and only estimate the betas. Then at least estimation is reduced to linear regression.

Hampton89 commented 2 years ago

Hey thank you for your reply,

I think I want to accurately calculate the 6 NSS parameters rather than estimate it, especially I dont know the value of Tau1/2, I tried your model, if I estimate tau1/2, the final output is the estimated value, rather than the function calculation.

I would like to get 6 parameters not by estimation, yo use the word 'ONLY 10 data points', do you think 10 data points on yield curve to estimate the 6 parameters are not enough? Do you think I should add more data points to use the function to get the accurate estimation of 6 parameters?

Thank you for your reply: )

luphord commented 2 years ago

I want to accurately calculate the 6 NSS parameters rather than estimate it

What exactly do you mean by an accurate calculation that is not an estimation? Do you hope for an explicit formula for the parameters?

do you think 10 data points on yield curve to estimate the 6 parameters are not enough?

Yes, I do think so. Adding more data points will help here. But again, I am not sure if I understand correctly what you are aiming for.

luphord commented 2 years ago

Is there any further interest in this or can the issue be closed?