Personal, I'm using this package and I'm having a problem.
MatrizCurva<-MatrizUmaLinha20colunas[1,1:20]
[1] 0.1164000 0.1264816 0.1265631 0.1366446 0.1467260 0.1568073 0.1668885 0.179694
[9] 0.1770501 0.1771306 0.1772109 0.1772908 0.1773703 0.1774496 0.1775284 0.1076068
[17] 0.1776847 0.1777621 0.1778391 0.17079155
> class(MatrizEttjDiaria[1,1:20])
[1] "numeric"
maturityBOND <- seq(1,20,1)
maturityBOND
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
The first function that is to return betas and lambda is ok:
NSParameters <- Nelson.Siegel( MatrizCurva, maturityBOND)
NSParameters
beta_0 beta_1 beta_2 lambda
[1,] 0.111046 -0.004705511 -0.003196441 0.08965621
It returns right. In the pdf it says MatrixCurva must be an xts type object. In my case MatrixCurve is a numeric object:
class(MatrizCurva )
[1] "numeric"
But it still does.
Now, when I call the NSrates function it has the following problem:
> NSParameters <- NSrates(NSParameters[1,],maturityBOND)
Error in matrix(0, nrow(Coeff), length(maturity)) :
non-numeric matrix extent
Should I turn to xts?
Actually, I've been trying to transforms into xts and the thing does not come out.