Ok, here it goes:
-------------------------------------------
open data9-13.gdt
list returns = *ret
# set some parameters for the rolling regression
scalar step = 1 # regression step
scalar size = 12 # regression size
scalar rolls = floor(($nobs - size + 1) / step) #number of rolls
scalar firstobs = $t1
# generate empty beta series
loop foreach i returns
series beta$i = NA
endloop
# set the initial sample
smpl firstobs firstobs+size-1
loop r = 1 .. rolls
loop foreach i returns
if sum(missing(returns.$i)) == 0
lad returns.$i const sp500
series beta$i[$t2] = $coeff[2]
endif
endloop
if r<rolls
smpl +step +step
endif
endloop
smpl --full
---------------------------------------------------------
In the example both OLS and LAD seem to work well. The problem is that
with my large data files, LAD doesn't work.
--
Filipe Rodrigues da Costa
Send me an email to: filipe(a)pobox.io
Reach me through Telegram at:
https://t.me/rodriguesdacosta
On Mon, 11 Dec 2017, at 16:36, Artur Tarassow wrote:
Am 11.12.2017 um 17:21 schrieb Filipe Rodrigues da Costa:
> Hi all,
>
> I'm trying to implement a rolling regression using the following
> specification:
>
> loop r = 1 .. rolls
> loop foreach i share
> if sum(missing(share.$i)) == 0
> lad share.$i const index
> series beta.$i[$t2] = $coeff[2]
> endif
> endloop
> if r<rolls
> smpl +step +step
> endif
> endloop
>
Hi Filipe, would be good if you could send a complete example script
using some dataset which is available to all.
Thanks,
Artur
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users