Toda+Yamamoto+example R
Toda+Yamamoto+example R
Toda+Yamamoto+example R
V.2<-VAR(cof1[,2:3],p=2,type="both")
serial.test(V.2)
#VAR-Model, lag=6
V.6<-VAR(cof1[,2:3],p=6,type="both")
serial.test(V.6)
# Model with p=6 is less likely to be serially correlated. Thus model with p=6 i
s selected.
# Model with additional lag is set up.
V.7<-VAR(cof1[,2:3],p=7,type="both")
# Wald-test for the first 6 lags
# VAR model is seperately set up as a linear model; makes the wald test easier
#lag variables
arab<-zoo(cof1["Arabica"])
robu<-zoo(cof1["Robusta"])
arab.l<-lag(arab,-(0:7),na.pad=T)
robu.l<-lag(robu,-(0:7),na.pad=T)
lm1<-lm(arab~arab.l[,2:8]+robu.l[,2:8]+index(arab))
lm2<-lm(robu~arab.l[,2:8]+robu.l[,2:8]+index(arab))
#Wald-test (H0: Robusta does not Granger-cause Arabica)
vcov(lm1)
wald.test(b=coef(lm1), Sigma=vcov(lm1), Terms= c(9:14),df=6)
# Could not be rejected (X2=8.6; p=0.2)
#Wald.test (H0: Arabica does not Granger-cause Robusta)
vcov(lm2)
wald.test(b=coef(lm2), Sigma=vcov(lm2), Terms= c(2:7),df=6)
# Could be rejected at 10% (X2=12.3; p=0.056)
# It seems that Arabica Granger-causes Robusta prices, but not the other way aro
und.