Discussion:
[Gretl-users] LM Test
Mark
2013-11-14 07:02:18 UTC
Permalink
How is the LM test calculated for Gretl for just a standard model.

I just ran a model

Model 5: OLS, using observations 1-2017

Dependent variable: nettfa



coefficient std. error t-ratio p-value

---------------------------------------------------------

const -20.9850 2.47202 -8.489 3.98e-017 ***

inc 0.770583 0.0614520 12.54 8.73e-035 ***

age25 0.0251267 0.00259339 9.689 9.96e-022 ***

male 2.47793 2.04778 1.210 0.2264

e401k 6.88622 2.12327 3.243 0.0012 ***



Mean dependent var 13.59498 S.D. dependent var 47.59058

Sum squared resid 3982124 S.E. of regression 44.48805

R-squared 0.127868 Adjusted R-squared 0.126134

F(4, 2012) 73.74763 P-value(F) 2.18e-58

Log-likelihood -10514.46 Akaike criterion 21038.91

Schwarz criterion 21066.96 Hannan-Quinn 21049.21



When I save the residuals squared to run the Pagan test I get this





Model 6: OLS, using observations 1-2017

Dependent variable: usq5




Coefficient

Std. Error

t-ratio

p-value




const

-4573.55

1848.7

-2.4739

0.01345

**


inc

112.358

45.9568

2.4449

0.01458

**


age25

4.84866

1.93946

2.5000

0.01250

**


male

2331.25

1531.43

1.5223

0.12810




e401k

1164.83

1587.89

0.7336

0.46330






Mean dependent var

1974.280



S.D. dependent var

33367.52


Sum squared resid

2.23e+12



S.E. of regression

33270.33


R-squared

0.007789



Adjusted R-squared

0.005817


F(4, 2012)

3.948695



P-value(F)

0.003387


Log-likelihood

-23861.35



Akaike criterion

47732.70


Schwarz criterion

47760.75



Hannan-Quinn

47742.99

The LM test from my understanding is n*r^2, which here would be 15.71



Using gretl's built in test I get the following:



Breusch-Pagan test for heteroskedasticity

OLS, using observations 1-2017

Dependent variable: scaled uhat^2



coefficient std. error t-ratio p-value

--------------------------------------------------------

const -2.31657 0.936391 -2.474 0.0134 **

inc 0.0569109 0.0232777 2.445 0.0146 **

age25 0.00245591 0.000982363 2.500 0.0125 **

male 1.18081 0.775689 1.522 0.1281

e401k 0.590001 0.804287 0.7336 0.4633



Explained sum of squares = 4485.49



Test statistic: LM = 2242.746588,

with p-value = P(Chi-square(4) > 2242.746588) = 0.000000



How did the LM test become so big for this model?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wfu.edu/pipermail/gretl-users/attachments/20131114/0811765b/attachment-0001.html
Allin Cottrell
2013-11-14 15:30:49 UTC
Permalink
Post by Mark
How is the LM test calculated for Gretl for just a standard model.
The Breusch-Pagan LM test for heteroskedasticity is calculated as per the
authors' 1979 Econometrica article (vol. 47, no. 5). That is, it is one
half of the explained sum of squares from a regression of the squared
residuals from the original OLS model, scaled by the MLE of the error
variance, on the original regressors.

Manual computation of the test statistic would look like this:

<hansl>
ols y const X
series u2 = $uhat^2
scalar sigma2 = $ess/$T
series g = u2/sigma2
ols g const X
scalar RSS = sst(g) - $ess
scalar LM = 0.5 * RSS
</hansl>

Allin Cottrell
Logan Kelly
2013-11-14 15:40:56 UTC
Permalink
Thanks! I am teaching this in my next MBA Stats class, so I am going to use your script as an example (with proper citation of course).

Cheers!

Logan

-----Original Message-----
From: gretl-users-bounces at lists.wfu.edu [mailto:gretl-users-bounces at lists.wfu.edu] On Behalf Of Allin Cottrell
Sent: Thursday, November 14, 2013 9:31 AM
To: Gretl list
Subject: Re: [Gretl-users] LM Test
Post by Mark
How is the LM test calculated for Gretl for just a standard model.
The Breusch-Pagan LM test for heteroskedasticity is calculated as per the authors' 1979 Econometrica article (vol. 47, no. 5). That is, it is one half of the explained sum of squares from a regression of the squared residuals from the original OLS model, scaled by the MLE of the error variance, on the original regressors.

Manual computation of the test statistic would look like this:

<hansl>
ols y const X
series u2 = $uhat^2
scalar sigma2 = $ess/$T
series g = u2/sigma2
ols g const X
scalar RSS = sst(g) - $ess
scalar LM = 0.5 * RSS
</hansl>

Allin Cottrell
Giuseppe Vittucci
2013-11-14 16:05:02 UTC
Permalink
Hi,

the version of the test that Mark computed is the same version discussed
by Wooldridge (2013) under the header of Breusch-Pagan test.

But this form of the test was suggested by Koenker (1981)
and it is a generalization of the heteroskedasticity test proposed by
Breusch and Pagan (1979).

The original Breusch-Pagan LM test (the one computed using the
hettest command in Stata and the gretl built-in command) is less general
as it requires normality of the errors.

The two tests can have different outcomes.

See you
Giuseppe
O
Post by Allin Cottrell
Post by Mark
How is the LM test calculated for Gretl for just a standard model.
The Breusch-Pagan LM test for heteroskedasticity is calculated as per the
authors' 1979 Econometrica article (vol. 47, no. 5). That is, it is one
half of the explained sum of squares from a regression of the squared
residuals from the original OLS model, scaled by the MLE of the error
variance, on the original regressors.
<hansl>
ols y const X
series u2 = $uhat^2
scalar sigma2 = $ess/$T
series g = u2/sigma2
ols g const X
scalar RSS = sst(g) - $ess
scalar LM = 0.5 * RSS
</hansl>
Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users at lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
Allin Cottrell
2013-11-14 16:28:04 UTC
Permalink
Post by Giuseppe Vittucci
Hi,
the version of the test that Mark computed is the same version discussed
by Wooldridge (2013) under the header of Breusch-Pagan test.
But this form of the test was suggested by Koenker (1981)
and it is a generalization of the heteroskedasticity test proposed by
Breusch and Pagan (1979).
The original Breusch-Pagan LM test (the one computed using the
hettest command in Stata and the gretl built-in command) is less general
as it requires normality of the errors.
But note also that gretl implements Koenker's robust variant of the 1979
B-P test (you add the --robust option to modtest --breusch-pagan).

Allin
Giuseppe Vittucci
2013-11-14 16:53:59 UTC
Permalink
Post by Allin Cottrell
Post by Giuseppe Vittucci
Hi,
the version of the test that Mark computed is the same version discussed
by Wooldridge (2013) under the header of Breusch-Pagan test.
But this form of the test was suggested by Koenker (1981)
and it is a generalization of the heteroskedasticity test proposed by
Breusch and Pagan (1979).
The original Breusch-Pagan LM test (the one computed using the
hettest command in Stata and the gretl built-in command) is less general
as it requires normality of the errors.
But note also that gretl implements Koenker's robust variant of the 1979
B-P test (you add the --robust option to modtest --breusch-pagan).
Touch? ;-)

Giuseppe
Post by Allin Cottrell
Allin
_______________________________________________
Gretl-users mailing list
Gretl-users at lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
Loading...