[R-SIG-Finance] Help with VECM
vramaiah at neo.tamu.edu
vramaiah at neo.tamu.edu
Thu Nov 17 23:55:08 CET 2011
Hi
I am new R user and I am working on a VECM problem.
I am following R Code 8-13 & 8-14 from "Analysis of Integrated & Cointegrated Time Series with R" by Bernhard Pfaff and repeatedly running into this problem,
"> svec<-SVEC(vecm,LR=LR,SR=SR,r=1,lrtest=FALSE,boot=TRUE,runs=100): Error in solve.default(infgamma) : system is computationally singular: reciprocal condition number = 1.02342e-018"
I followed the example given in the book for "Canada" with the only difference is specifying the triangular matrix.I hope you can point out the mistake I am making.
Ram Ramaiah
For the background info; here are the output for 8-13 and partial 8-14 (upto the error message)> us=read.table("USData.4.txt",header=T)
> vecm<-ca.jo(us[,c("Y","C")],type="trace",ecdet="trend",K=3,spec="transitory")
> vecm.r1<-cajorls(vecm,r=1)
> alpha<-coef(vecm.r1$rlm)[1,]
> beta<-vecm.r1$beta
> vecm.r1
$rlm
Call:
lm(formula = substitute(form1), data = data.mat)
Coefficients:
Y.d C.d
ect1 -0.11653 -0.01562
constant 0.06338 0.01019
Y.dl1 0.14179 0.14814
C.dl1 0.27211 -0.07662
Y.dl2 0.03149 -0.07692
C.dl2 0.18011 0.27390
$beta
ect1
Y.l1 1.000000e+00
C.l1 -9.217918e-01
trend.l1 5.260375e-05
> alpha
Y.d C.d
-0.11652600 -0.01561989
> resids<-resid(vecm.r1$rlm)
> N<-nrow(resids)
> sigma<-crossprod(resids)/N
> sigma
Y.d C.d
Y.d 1.453332e-05 7.791666e-06
C.d 7.791666e-06 1.214965e-05
> alpha.se<-sqrt(solve(crossprod(cbind(vecm at ZK%*%beta,vecm at Z1)))[1,1]*diag(sigma))
> alpha.t<-alpha/alpha.se
> beta.se<-sqrt(diag(kronecker(solve(crossprod(vecm at RK[,-1])),solve(t(alpha)%*%solve(sigma)%*%alpha))))
> beta.t<-c(NA,beta[-1]/beta.se)
> alpha.se
Y.d C.d
0.02906554 0.02657529
> alpha.t
Y.d C.d
-4.009078 -0.587760
> beta.se
[1] 0.1414234204 0.0003404039
> beta.t
[1] NA -6.5179575 0.1545333
> SR<-matrix(NA,nrow=2,ncol=2)
> SR[1,2]<-0
> SR
[,1] [,2]
[1,] NA 0
[2,] NA NA
> LR<-matrix(NA,nrow=2,ncol=2)
> LR[1,2]<-0
> LR
[,1] [,2]
[1,] NA 0
[2,] NA NA> svec<-SVEC(vecm,LR=LR,SR=SR,r=1,lrtest=FALSE,boot=TRUE,runs=100)
Error in solve.default(infgamma) :
system is computationally singular: reciprocal condition number = 1.02342e-018
More information about the R-SIG-Finance
mailing list