# [Gretl-users] Heteroskedasticity / correction

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Fri Jan 10 13:18:23 EST 2014

```On Fri, 10 Jan 2014, Ana Amaro ISG wrote:

>
>
> Sent from my iPhone
> Apologize for the brevity/grammar/spelling
>
> No dia 10/01/2014, às 17:48, Sven Schreiber <svetosch at gmx.net> escreveu:
>
>> Am 10.01.2014 18:38, schrieb Ana Amaro ISG:
>>> Hi everyone
>>> I need some help on this topic:
>>> 1- simple model one regressor (x)
>>> 2- error is heteroskedastic (and residual analysis shows that the error variance increases with x variable)
>>> 3- rerun the analysis dividing both model members by the sqrt(x) - no constant
>>
>> why no constant here? usually you need to have good reasons for that --
>> if you had a constant in step 1, dividing everything by some number does
>> not eliminate the constant.
> When dividing the original constant by sqrt(x) the constant disapears:(

Sure?

<hansl>
nulldata 100
set seed 987
x = uniform()
e = normal()
y = x + e
ols y const x
modtest --white

sqrtx = sqrt(x)
ymod = y / sqrtx
cmod = 1 / sqrtx
ols ymod cmod sqrtx
modtest --white
</hansl>

here gives

<output>
Model 1: OLS, using observations 1-100
Dependent variable: y

coefficient   std. error   t-ratio   p-value
--------------------------------------------------------
const       −0.183247     0.195633    −0.9367   0.3512
x            1.77855      0.322094     5.522    2.75e-07 ***

Mean dependent var   0.750871   S.D. dependent var   1.119396
Sum squared resid    94.61446   S.E. of regression   0.982575
F(1, 98)             30.49066   P-value(F)           2.75e-07
Log-likelihood      −139.1259   Akaike criterion     282.2517
Schwarz criterion    287.4621   Hannan-Quinn         284.3604

? modtest --white

White's test for heteroskedasticity
OLS, using observations 1-100
Dependent variable: uhat^2

coefficient   std. error   t-ratio   p-value
-------------------------------------------------------
const        1.13073      0.439983     2.570    0.0117  **
x           −1.77980      2.08494     −0.8536   0.3954
sq_x         2.03353      1.96553      1.035    0.3034

Test statistic: TR^2 = 1.613760,
with p-value = P(Chi-square(2) > 1.613760) = 0.446248

? sqrtx = sqrt(x)
Generated series sqrtx (ID 5)
? ymod = y / sqrtx
Generated series ymod (ID 6)
? cmod = 1 / sqrtx
Generated series cmod (ID 7)
? ols ymod cmod sqrtx

Model 2: OLS, using observations 1-100
Dependent variable: ymod

coefficient   std. error   t-ratio   p-value
--------------------------------------------------------
cmod       −0.0735086     0.118736    −0.6191   0.5373
sqrtx       1.56961       0.342301     4.585    1.34e-05 ***

Mean dependent var   0.923079   S.D. dependent var   1.916162
Sum squared resid    340.0252   S.E. of regression   1.862698
F(2, 98)             15.66129   P-value(F)           1.25e-06
Log-likelihood      −203.0863   Akaike criterion     410.1727
Schwarz criterion    415.3830   Hannan-Quinn         412.2814

? modtest --white

White's test for heteroskedasticity
OLS, using observations 1-100
Dependent variable: uhat^2

coefficient   std. error   t-ratio   p-value
-------------------------------------------------------
cmod         12.3469      19.7685      0.6246   0.5337
sqrtx       −14.3832     121.333      −0.1185   0.9059
sq_cmod      −1.25675      1.57423    −0.7983   0.4267
X1_X2       −12.8604      78.7441     −0.1633   0.8706
sq_sqrtx     18.2010      62.4175      0.2916   0.7712

Test statistic: TR^2 = 33.927864,
with p-value = P(Chi-square(4) > 33.927864) = 0.000001
</output>

-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)

Università Politecnica delle Marche
(formerly known as Università di Ancona)

r.lucchetti at univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
```