Dear Allin,

I guess I got the point. Thank you so much for your advice.

Best,
Amir

On Thu, Mar 27, 2008 at 5:25 AM, Allin Cottrell <cottrell@wfu.edu> wrote:
On Wed, 26 Mar 2008, Mariusz Doszy? wrote:

> I doubt that the tests you are asking for are built in gretl,
> but it's quite easy to apply them with using scripting. You need
> just standard commands...

Mariusz is right, these are not (yet) built-in commands, but since
this is not the first time the Breusch-Pagan test has been
requested, I've added it in CVS.  Goldfeld-Quandt is conceptually
simple, but a little awkward to script since you have to sort all
the observations by the value of the chosen Xi.  That can be done
(see the "sortby" function) but it could be made easier (and will
be, before long).

In the meantime, here is an illustration of how you can do
Breusch-Pagan:

<gretlscript>
# Variants on Breusch-Pagan test, simple example

open data4-1
list xlist = 2
ols 1 0 xlist
u2 = $uhat * $uhat
ols u2 0 2 --quiet
# White-type test statistic
LM1 = $nrsq

# Basic Breusch-Pagan (Econometrica, 1979)
s2 = sum(u2)/$T
g = u2/s2
ols g 0 xlist --quiet
gbar = mean(g)
gdev = g - gbar
TSS = sum(gdev*gdev)
ESS = $ess
# LM = one half of the explained sum of squares
LM2 = .5*(TSS-$ess)

# Koenker robust variant (Journal of Econometrics, 1981)
V = (1/$T)*sum((u2 - s2)^2)
g = u2 - s2
ols g 0 xlist --quiet
gbar = mean(g)
gdev = g - gbar
TSS = sum(gdev*gdev)
ESS = $ess
LM3 = (TSS-ESS)/V

# compare the variants
print LM1 LM2 LM3

# shortcuts, new in gretl CVS
ols 1 0 xlist --quiet
lmtest --breusch
lmtest --breusch --robust  # invokes Koenker
</gretlscript>

Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users



--
<signature>
Amir Reza Khosroshai
</signature>