Skip to content
Prev 5809 / 15274 Next

about Nelson-Siegel model fitting

Yin ZHANG wrote:
>
As I told you before, the spot yield on a bond, given it's observed price and 
known maturity, is simple algebra.  R can do this easily, with or without the 
aid of a package.  You don't need a 'toolbox' to calculate these things, or to 
graph the resulting yield curve, fitted or not.  There are tools for doing this 
(see below) if you want them.

(there's absolutely no point in fitting a yield curve at this stage if the 
output of the fitted model isn't what you want)

You aren't going to get past the step of converting spot prices to yields on 
each series.  You have to do it to get what you want.  Write a function, make 
it easily repeatable, or use one of the packages.
The input to every Nelson Siegel method that I'm aware of is a set of spot 
yields and maturities. The output is a fitted yield curve and the parameters of 
the stochastic term structure model.


The packages I'm aware of for doing all this in R are

'YieldCurve', which I mentioned in my previous email.

'fBonds' which you are already familiar with.

'RQuantLib' which as discussed only returns the fitted curve, and

'termstrc' which contains a setting for using *prices* to calculate the yield 
and then fit the model.
http://cran.r-project.org/web/packages/termstrc/index.html
http://r-forge.r-project.org/projects/termstrc/

The only thing I can think of is that you haven't tried termstrc, otherwise I'm 
not sure what you've done here except to re-ask the same question.

In the interests of exposition and to aid future searches, all of these 
packages are mentioned in the CRAN Finance Task View:

http://cran.r-project.org/web/views/Finance.html

Regards,

   - Brian