Gregory Chaudoin | 3 Dec 21:03 2013

Breusch-Godfrey test

I am teaching an econometrics course where we are testing for autorcorrelation.  

In GRETL the Breusch-Godrey test is in TESTS--Autocorrelation and you set the number of lags.  

The problem is that the Gretl BG test does not adjust of the number of lags.  For example, suppose we have a sample of 100 observations.

The BG test (using 4 lags of the residual) regresses the current residual against the x variables and 4 lagged residuals.  We can then use the LM test statistics = (100- 4)*R^2.

The problem that I have with GRETL is that its test statistics uses T=100 in the auxiliary regression instead of the proper 96 (we use up 4 observations with the lags.)

Why does Gretl do this? 

-Greg
<div><div dir="ltr">I am teaching an econometrics course where we are testing for autorcorrelation. &nbsp;<div><br></div>
<div>In GRETL the Breusch-Godrey test is in TESTS--Autocorrelation and you set the number of lags. &nbsp;</div>
<div>
<br>
</div>
<div>The problem is that the Gretl BG test does not adjust of the number of lags. &nbsp;For example, suppose we have a sample of 100 observations.</div>
<div><br></div>
<div>The BG test (using 4 lags of the residual) regresses the current residual against the x variables and 4 lagged residuals. &nbsp;We can then use the LM test statistics = (100- 4)*R^2.</div>
<div><br></div>
<div>The problem that I have with GRETL is that its test statistics uses T=100 in the auxiliary regression instead of the proper 96 (we use up 4 observations with the lags.)</div>
<div><br></div>
<div>Why does Gretl do this?&nbsp;</div>
<div><br></div>
<div>-Greg</div>
</div></div>
Riccardo (Jack) Lucchetti | 4 Dec 01:06 2013
Picon

Re: Breusch-Godfrey test

On Tue, 3 Dec 2013, Gregory Chaudoin wrote:

> I am teaching an econometrics course where we are testing for
> autorcorrelation.
>
> In GRETL the Breusch-Godrey test is in TESTS--Autocorrelation and you set
> the number of lags.
>
> The problem is that the Gretl BG test does not adjust of the number of
> lags.  For example, suppose we have a sample of 100 observations.
>
> The BG test (using 4 lags of the residual) regresses the current residual
> against the x variables and 4 lagged residuals.  We can then use the LM
> test statistics = (100- 4)*R^2.
>
> The problem that I have with GRETL is that its test statistics uses T=100
> in the auxiliary regression instead of the proper 96 (we use up 4
> observations with the lags.)
>
> Why does Gretl do this?

Gretl uses one of the existing variants to this test: you substitute zeros 
for pre-sample residuals. Of course, the difference you get with the 
procedure you're suggesting are asymptotically negligible. See the 
following script for an example:

<hansl>
nulldata 100
setobs 1 1 --special-time-series
x = normal()
y = normal() + 1 + x
ols y 0 x
u = $uhat

list U = null
loop i=1..4 --quiet
     u$i = misszero(u(-i))
     U += u$i
endloop

ols u 0 x U
T1 = $rsq * $T
ols u 0 x u(-1 to -4)
T2 = $rsq * $T
</hansl>

Oh, and before you say: "yes, but in finite samples the two variants may 
be very different", let me just remind you taht if you really cared about 
what happens in finite samples, you shouldn't be using LM tests anyway :)

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti@...
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
On Tue, 3 Dec 2013, Gregory Chaudoin wrote:

> I am teaching an econometrics course where we are testing for
> autorcorrelation.
>
> In GRETL the Breusch-Godrey test is in TESTS--Autocorrelation and you set
> the number of lags.
>
> The problem is that the Gretl BG test does not adjust of the number of
> lags.  For example, suppose we have a sample of 100 observations.
>
> The BG test (using 4 lags of the residual) regresses the current residual
> against the x variables and 4 lagged residuals.  We can then use the LM
> test statistics = (100- 4)*R^2.
>
> The problem that I have with GRETL is that its test statistics uses T=100
> in the auxiliary regression instead of the proper 96 (we use up 4
> observations with the lags.)
>
> Why does Gretl do this?

Gretl uses one of the existing variants to this test: you substitute zeros 
for pre-sample residuals. Of course, the difference you get with the 
procedure you're suggesting are asymptotically negligible. See the 
following script for an example:

<hansl>
nulldata 100
setobs 1 1 --special-time-series
x = normal()
y = normal() + 1 + x
ols y 0 x
u = $uhat

list U = null
loop i=1..4 --quiet
     u$i = misszero(u(-i))
     U += u$i
endloop

ols u 0 x U
T1 = $rsq * $T
ols u 0 x u(-1 to -4)
T2 = $rsq * $T
</hansl>

Oh, and before you say: "yes, but in finite samples the two variants may 
be very different", let me just remind you taht if you really cared about 
what happens in finite samples, you shouldn't be using LM tests anyway :)

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti@...
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
Gregory Chaudoin | 4 Dec 16:59 2013

Re: Breusch-Godfrey test

Jack,

Thanks for the response.  I was JUST ABOUT to say, "yes, but in finite samples the two variants may be very different," but you cut me off!

The only issue I have is that I teach out of Hill, Griffiths and Lim's Principles of Econometrics and their "n" in the LM = n*R-squared is T - # lags.  But your variant actually provides a great teaching opportunity in that I can emphasize that the LM test is only asymptotically Chi-Squared.  Alas! Small sample inference from the test is unreliable.

Besides, it's easy enough to save the residuals and run my own auxiliary regression with lags to duplicate the findings of a text using T - # lags.  Another teaching opportunity! 

I appreciate the hard work you put into Gretl.  It has added a lot to my course.

-Greg


On Tue, Dec 3, 2013 at 6:06 PM, Riccardo (Jack) Lucchetti <r.lucchetti-kONsfx5siupeoWH0uzbU5w@public.gmane.org> wrote:
On Tue, 3 Dec 2013, Gregory Chaudoin wrote:

I am teaching an econometrics course where we are testing for
autorcorrelation.

In GRETL the Breusch-Godrey test is in TESTS--Autocorrelation and you set
the number of lags.

The problem is that the Gretl BG test does not adjust of the number of
lags.  For example, suppose we have a sample of 100 observations.

The BG test (using 4 lags of the residual) regresses the current residual
against the x variables and 4 lagged residuals.  We can then use the LM
test statistics = (100- 4)*R^2.

The problem that I have with GRETL is that its test statistics uses T=100
in the auxiliary regression instead of the proper 96 (we use up 4
observations with the lags.)

Why does Gretl do this?

Gretl uses one of the existing variants to this test: you substitute zeros for pre-sample residuals. Of course, the difference you get with the procedure you're suggesting are asymptotically negligible. See the following script for an example:

<hansl>
nulldata 100
setobs 1 1 --special-time-series
x = normal()
y = normal() + 1 + x
ols y 0 x
u = $uhat

list U = null
loop i=1..4 --quiet
    u$i = misszero(u(-i))
    U += u$i
endloop

ols u 0 x U
T1 = $rsq * $T
ols u 0 x u(-1 to -4)
T2 = $rsq * $T
</hansl>

Oh, and before you say: "yes, but in finite samples the two variants may be very different", let me just remind you taht if you really cared about what happens in finite samples, you shouldn't be using LM tests anyway :)

-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucchetti <at> univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users-npDYnXcwJHngpn9g0Uvcdg@public.gmane.org
http://lists.wfu.edu/mailman/listinfo/gretl-users

<div>
<div dir="ltr">Jack,<div><br></div>
<div>Thanks for the response. &nbsp;I was JUST ABOUT to say,&nbsp;<span>"yes, but in finite samples the two variants may be very different," but you cut me off!</span>
</div>
<div><span><br></span></div>
<div>
<span>The only issue I have is that I teach out of Hill, Griffiths and Lim's Principles of Econometrics and their "n" in the LM = n*R-squared is T - # lags. &nbsp;But your variant actually provides a great teaching opportunity in that I can emphasize that the</span><span>&nbsp;LM test is only&nbsp;</span>asymptotically Chi-Squared. &nbsp;Alas! Small sample inference from the test is unreliable.</div>
<div><br></div>
<div>Besides, it's easy enough to save the residuals and run my own auxiliary regression with lags to duplicate the findings of a text using T - # lags. &nbsp;Another teaching opportunity!&nbsp;</div>
<div><br></div>
<div>
<span>I appreciate the</span>&nbsp;hard work you put into Gretl. &nbsp;It has added a lot to my course.</div>
<div><br></div>
<div>-Greg</div>
</div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Dec 3, 2013 at 6:06 PM, Riccardo (Jack) Lucchetti <span dir="ltr">&lt;<a href="mailto:r.lucchetti@..." target="_blank">r.lucchetti@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div class="HOEnZb"><div class="h5">On Tue, 3 Dec 2013, Gregory Chaudoin wrote:<br><br><blockquote class="gmail_quote">
I am teaching an econometrics course where we are testing for<br>
autorcorrelation.<br><br>
In GRETL the Breusch-Godrey test is in TESTS--Autocorrelation and you set<br>
the number of lags.<br><br>
The problem is that the Gretl BG test does not adjust of the number of<br>
lags. &nbsp;For example, suppose we have a sample of 100 observations.<br><br>
The BG test (using 4 lags of the residual) regresses the current residual<br>
against the x variables and 4 lagged residuals. &nbsp;We can then use the LM<br>
test statistics = (100- 4)*R^2.<br><br>
The problem that I have with GRETL is that its test statistics uses T=100<br>
in the auxiliary regression instead of the proper 96 (we use up 4<br>
observations with the lags.)<br><br>
Why does Gretl do this?<br>
</blockquote>
<br>
</div></div>
Gretl uses one of the existing variants to this test: you substitute zeros for pre-sample residuals. Of course, the difference you get with the procedure you're suggesting are asymptotically negligible. See the following script for an example:<br><br>
&lt;hansl&gt;<br>
nulldata 100<br>
setobs 1 1 --special-time-series<br>
x = normal()<br>
y = normal() + 1 + x<br>
ols y 0 x<br>
u = $uhat<br><br>
list U = null<br>
loop i=1..4 --quiet<br>
&nbsp; &nbsp; u$i = misszero(u(-i))<br>
&nbsp; &nbsp; U += u$i<br>
endloop<br><br>
ols u 0 x U<br>
T1 = $rsq * $T<br>
ols u 0 x u(-1 to -4)<br>
T2 = $rsq * $T<br>
&lt;/hansl&gt;<br><br>
Oh, and before you say: "yes, but in finite samples the two variants may be very different", let me just remind you taht if you really cared about what happens in finite samples, you shouldn't be using LM tests anyway :)<br><br>
-------------------------------------------------------<br>
&nbsp; Riccardo (Jack) Lucchetti<br>
&nbsp; Dipartimento di Scienze Economiche e Sociali (DiSES)<br><br>
&nbsp; Universit&agrave; Politecnica delle Marche<br>
&nbsp; (formerly known as Universit&agrave; di Ancona)<br><br>
&nbsp; <a href="mailto:r.lucchetti@..." target="_blank">r.lucchetti <at> univpm.it</a><br>
&nbsp; <a href="http://www2.econ.univpm.it/servizi/hpp/lucchetti" target="_blank">http://www2.econ.univpm.it/servizi/hpp/lucchetti</a><br>
-------------------------------------------------------<br>_______________________________________________<br>
Gretl-users mailing list<br><a href="mailto:Gretl-users@...">Gretl-users@...</a><br><a href="http://lists.wfu.edu/mailman/listinfo/gretl-users" target="_blank">http://lists.wfu.edu/mailman/listinfo/gretl-users</a><br>
</blockquote>
</div>
<br>
</div>
</div>

Gmane