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