fBonds svensson fitting
Nelson-siegel and svensson are easy to fit (see http://www.bankofcanada.ca/en/res/tr/1999/tr84.pdf) I used the following test data > fwdcrv tenor fwd 1 1 1.10000 2 2 1.11927 3 3 1.13754 4 4 1.15735 5 5 1.22402 6 6 1.26254 7 7 1.33145 8 8 1.40115 9 9 1.47255 10 10 1.62928 11 11 1.69269 12 12 1.81135 And now in R one could do the following: ------------------------------- nelson<-function(x,y=x) { nelson<- sum((y[,2]-(x[1] + (x[2] + x[3]* y[,1])* exp(-x[4]* y[,1])))^2) } r = nlm(f=nelson,p=c(1,10,10,10),y=fwdcrv,steptol=1e-10,iterlim=500) $minimum [1] 0.6461518 $estimate [1] 1.361599 8.683838 8.683784 36.325287 $gradient [1] 1.431076e-08 0.000000e+00 0.000000e+00 0.000000e+00 $code [1] 1 $iterations [1] 139 Note svensson is double humped so you have an additional parameter ( x[5] ) and so modify the function suitably. Hope this helps, Kris
Thomas Steiner wrote:
I'd like to calculate forward rates from swap rates and then fit these fwd-rates to a Svensson family and see how parameters envolve over time (consistency). I've read of the R-package fBonds, which could help me a lot. It is not availible at CRAN or www.metrics.org Does anybody know about its current state? Is it available to the public somewhere? Are there any other packages that could help me? Thanks for suggestions, help and hints Thomas
_______________________________________________ R-sig-finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance