# [Gretl-users] Pagan Heteroskedasticity Test

Allin Cottrell cottrell at wfu.edu
Mon May 4 10:16:39 EDT 2015

```On Mon, 4 May 2015, Graham Stark wrote:

> I'm puzzled by the output of the Breusch-Pagan Heterokskedasticity test
>
> The example here:
>
> http://virtual-worlds-research.com/ou/econometrics/hetero_test.zip
>
> shows me attempting to replicate Gretl's Breusch-Pagan and White tests
> on a simple teaching dataset. The White Test is identical but the Pagan
> test is very different from how I always thought you did it. Apologies
> if I've misunderstood what you're doing.

The Breusch-Pagan test we compute is the one defined by Breusch and
Pagan in their 1979 Econometrica article. The dependent variable in
their auxiliary regression is the scaled squared residual from OLS
estimation. Here's how it can be replicated using your dataset:

<hansl>
open ema01.gdt --quiet

l_totas = log(totas)
l_empl  = log(empl)
l_rdexp = log(rdexp)
l_turn = log(turn)
ols l_turn const l_empl l_totas l_rdexp
modtest --breusch-pagan

# Breusch-Pagan test by hand
s2 = \$ess / \$T
series u2s = \$uhat^2 / s2
ols u2s const l_totas l_empl l_rdexp
ptest_p = pvalue(c, \$ncoeff-1, ptest_stat)
printf "test = %g, p-value = %g\n", ptest_stat, ptest_p
</hansl>

Note that we also offer Koenker's robust variant of the above (add the
--robust flag). In that case the test would be:

<hansl>
# Robust B-P test by hand
s2 = \$ess / \$T
V = sst(\$uhat^2 - s2) / \$T
series u2s = \$uhat^2 - s2
ols u2s const l_totas l_empl l_rdexp