On Mon, 7 Nov 2022, Torbjørn Lorentzen wrote:
Hi all,
I'm a new user of Gretl. I'm using ols in the estimation of a time
series model. T want to us ethe HAC-option to correct for
autocorrelation and heteroscedasticity. I tried the robust option, but
to what I can see it only corrects for heteroscedasticity?
Great if anyone could help me with the Gretl script for HAC and how to
put it together with the ols command. All suggestions are appreciated 😊
If your dataset is set as "time series", the HAC option should apply
automatically where you use the "--robust" option.
If you read the data from some external format, such as csv, excel, stata
etc., maybe you didn't set up your dataset as "time series". You can do
this either via the "setobs" command, or via the GUI client by selecting
the "Data > Dataset Structure" menu. Once the time series information is
set, by saving your data in gdt format, it will be retained next time you
open the file.
In a script you'd do something like
<hansl>
open mydata.csv
setobs 12 2012:03 # monthly data starting on March 2012
ols y const x --robust
</hansl>
Regards,
Tobben
One small thing: you're posting from a different email address than the
one you used for registering, so I had to let your message through "by
hand". Not a big deal, of course, but it'd be better if you used the
correct one.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------