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@univpm.it> 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@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users