Re: [R] grangertest/lmtest ... what am I doing wrong ?

From: Achim Zeileis <Achim.Zeileis_at_wu-wien.ac.at>
Date: Mon, 18 Aug 2008 00:33:06 +0200 (CEST)

On Sun, 17 Aug 2008, tolga.i.uzuner_at_jpmorgan.com wrote:

> Dear Achim, R Users,
>
> What am I doing wrong in this example ?

The Granger test of x and y with lag k tests the significance of the x variables in

   y ~ Lags(y, 1:k) + Lags(x, 1:k)
If x is already a lag of y (as in your example), this is not really meaningful. In the "lmtest" implementation, it leads to collinearities. I'm not sure what MSBVAR does to resolve that. Z

> a<-zoo(rnorm(100),order.by=1:100)
> b<-lag(a)
> regr<-na.exclude(merge(a,b))
> plot(regr)
> grangertest(regr[,1],regr[,2],3)
>
>> a<-zoo(rnorm(100),order.by=1:100)
>> b<-lag(a)
>> regr<-na.exclude(merge(a,b))
>> plot(regr)
>> grangertest(regr[,1],regr[,2],3)
> Error in solve(vc[ovar, ovar]) : subscript out of bounds
>>
>
> This works fine in granger.test from the MSBVAR package:

>
>> a<-zoo(rnorm(100),order.by=1:100)
>> b<-lag(a)
>> regr<-na.exclude(merge(a,b))
>> plot(regr)
>> granger.test(regr,3)
> F-statistic p-value
> b -> a 1.259314e+34 0.0000000
> a -> b 6.167865e-01 0.6059222
>>
>
> Thanks in advance,
> Tolga
>
> Generally, this communication is for informational pur...{{dropped:30}}



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 17 Aug 2008 - 22:54:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Aug 2008 - 12:33:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive