3
Guys, I’m using this package and I have a little 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 which is to return the Betas and the 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 that Matrizcurva needs to be an object of type xts. In my case Matrizcurva is an object "Numeric":
class(MatrizCurva )
[1] "numeric"
But it still spins.
Now, when I call the Nsrates function presents the following problem:
> NSParameters <- NSrates(NSParameters[1,],maturityBOND)
Error in matrix(0, nrow(Coeff), length(maturity)) :
non-numeric matrix extent
I must turn to xts?
In fact, I’ve been trying to turn to xts and the thing doesn’t come out.