On Sat, 1 Feb 2014, Moses Nwanji wrote:
Dear Sir/Madam,
I am sending this email regarding a query I had about the code needed
for a 'rolling regression' in gretl.
I am currently trying to analyse the unemployment-output relationship,
and I plan to use the rolling regression approach to test whether the
relationship is stable over time (estimated coeffcients). However, the
issue I have is with the coding, which I have no clue about.
Please if there is anything you can do, I would be willing to hear back
from you.
I hope you find the example below helpful; strictly speaking, it's not the
most efficient implementation one could code, nor the most general, but it
should be a nice base for you to build on.
<hansl>
set echo off
set messages off
open sw_ch14.gdt
infl = 400 * ldiff(PUNEW)
T = $nobs
scalar window_size = 20
scalar k = $nobs - window_size + 1
series b = NA
series lo = NA
series hi = NA
smpl 1 window_size
loop i = window_size .. T --quiet
ols infl const LHUR --quiet
b[i] = $coeff[2]
scalar s = $stderr[2]
lo[i] = b[i] - 1.96 * s
hi[i] = b[i] + 1.96 * s
if i < T
smpl +1 +1
endif
endloop
smpl full
gnuplot b lo hi --output=display --with-lines --time-series
</hansl>
-------------------------------------------------------
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
-------------------------------------------------------