[R-SIG-Finance] YieldCurve package
Jeff Ryan
jeff.a.ryan at gmail.com
Mon Aug 12 05:33:37 CEST 2013
Try posting sessionInfo(). Your packages matter far more than your system in 99.99% of cases.
Also, providing the result of traceback() immediately after the failed call can be illustrative.
Best,
Jeff
Jeffrey Ryan | Founder | jeffrey.ryan at lemnica.com
www.lemnica.com
On Aug 11, 2013, at 10:56 AM, jaimie villanueva <jaimie.villanueva at gmail.com> wrote:
> Hi there,
>
> I'm facing some problems since I've updated the YieldCurve package from <<
> YieldCurve_4.0 >> to << YieldCurve_4.1 >>
>
> I would like to get Nelson Siegel rates. To do so, I'm using
> "Nelson.Siegel" function in order to compute beta and lambda parameters and
> "NSrates" function to compute Nelson Siegel rates. The thing is that the
> following code I'm about to show You, did work in the past with my older
> version of the package, but It doesn't work now.
>
> The problem occurs when setting up Nelson Siegel function:
>
> This is the code:
>
>> Sys.info()
> sysname release
> version
> "Windows" "7 x64" "build 7601,
> Service Pack 1"
> nodename machine
> login
> "JVC-PC" "x86-64"
> "JVC"
> user effective_user
> "JVC" "JVC"
>
> library(RODBC)
>> library(TSA)
>> library(grDevices)
>> library(YieldCurve)
>> library(xts)
>>
>>
>> ######### CONFIGURACI�N INICIAL
>> #
>>
>> plazos.NG=array(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
> + 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
> + 42,43,44,45,46,47,48,49,50))
>>
>>
> CURVA.EUR=array(c(1.415943,1.302205,1.380278,1.533634,1.725201,1.920058,2.083162,2.214956,
> + 2.32518,2.422087,2.591747,2.735049,2.739023,2.644585,2.543769))
>>
>> m=length(plazos.NG)
>> CURVA.EUR.NG=array(NA,c(m))
>> plazos.EUR=array(c(1,2,3,4,5,6,7,8,9,10,12,15,20,25,30))
>>
>> #
>> #########
>>
>> NEW.VECT.1=cbind(plazos.NG,CURVA.EUR.NG)
>> NEW.VECT.2=cbind(plazos.EUR,CURVA.EUR)
>>
>>
>> # CREAMOS EL VECTOR CON TIPOS
>>
>> l= length(plazos.EUR)
>> posicX=1
>> posicY=1
>>
>> for(k in 1:l)
> + {
> + # BUSCAMOS LA POSICION DE CADA PUNTO DE LA CURVA.
> +
> + while(NEW.VECT.1[posicY,1]!= NEW.VECT.2[posicX,1]){posicY=posicY+1}
> + NEW.VECT.1[posicY,2]=NEW.VECT.2[posicX,2]
> + posicX=posicX+1
> + posicY=posicY+1
> +
> + }
>>
>> NSParameters= Nelson.Siegel(rate=NEW.VECT.1[,2],maturity=NEW.VECT.1[,1])
>> fitted.rates= NSrates(NSParameters, NEW.VECT.1[,1])
>
> *Error in xts(matrix(0, nrow(Coeff), length(maturity)), order.by =
> time(Coeff)) : *
> * order.by requires an appropriate time-based object*
> *
> *
> Any help would be kindly appreciated.
> Thanks in advance.
>
> --
> *Jaimie.*
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
More information about the R-SIG-Finance
mailing list