On Tue, 16 Oct 2012, Marcin Pietrzak wrote:
I am writing to you in order to find some help concerning
construction of
the loop. My aim is to build a loop which automatically create a first
differences of each time serie if it does not pass the ADF test. You can
find below my script but there is something wrong with it because it shows
a problem with commaf 'if'.
loop foreach i xlist
adf 30 xlist.$i --test-down
genr p$i = $pvalue
if p$i < 0,05
genr d_i = diff(xlist.$i)
endloop
Do you have any ideas what should be changed?
You need "endif" to terminate an "if" block; you cannot use
',' as the decimal character in gretl scripts; and it seems
your test is probably backwards: if the p-value is small you
are rejecting the unit-root null, so why difference?
<hansl>
loop foreach i xlist
adf 30 xlist.$i --test-down
if $pvalue > 0.05
diff xlist.$i
endif
endloop
</hansl>
Also 30 is quite an extravagant lag order; the ADF test may
fail unless you have plenty of observations.
Allin Cottrell