# [Gretl-users] data mining with rolling regression and restricted coefficients

Jan Tille Jan.Tille at absolut-research.de
Wed Sep 5 03:21:34 EDT 2012

```Allin, sorry - I have got the if block wrong. I put changed the block so that the restrictions follow the if commands.

Jan

-----Ursprüngliche Nachricht-----
Von: Plus.line MailSystem [mailto:cyrus at mailer.plusline.de] Im Auftrag von Jan Tille
Gesendet: Dienstag, 4. September 2012 15:45
An: Gretl list
Betreff: Re: [Gretl-users] data mining with rolling regression and restricted coefficients

Allin, Thank you - I hope that I got it right now, when I say that it is preferable .

As wrote in the mail to Jack, then it is preferable to omit insignificant variables in the first step and re-estimate the reduced model with the portfolio constraint. That should work quite well.

Nonetheless I am struck with the problem, that I don't know ex-ante how many insignificant variables might be dropped. I guess, that is what you mean by "you need to decide how you're going to respecify the restriction in case some terms are not statistically significant".

If I assume the 3-Variable case, then in the worst case three variables (four including the constant) might be dropped.

To control for this and to respecify the restriction after omitting the variables, I implemented the if-block below:

matrix CO={}
# ---- estimate unrestricted model-----
ols y const x1 x2 x3

scalar kfull=\$ncoeff

#---- omit insignificant variables----
omit --auto

#---determine how many coefficients are left---- scalar k=kfull-\$ncoeff

restrict
if k=0 #---if all variables are significant
b[2]+b[3]+b[4]= 1
elif k=1 #----if one variable has been dropped
b[2]+b[3] 1
else k=2 #----if two variables have been dropped
b[2]=1
endif
end restrict

matrix co = \$coeff'
CO = CO | co

Still, if I want to put it into a rolling regression, then I would need to set up the coefficient matrix correctly.

Kind regards,

Jan

-----Ursprüngliche Nachricht-----
Von: Plus.line MailSystem [mailto:cyrus at mailer.plusline.de] Im Auftrag von Allin Cottrell
Gesendet: Dienstag, 4. September 2012 14:09
An: Gretl list
Betreff: Re: [Gretl-users] data mining with rolling regression and restricted coefficients

On Tue, 4 Sep 2012, Jan Tille wrote:

> point your are making. [...] I understand that this is quite
> bothering. Maybe it is not as simple as I thought or at least not as
> simple to implement in Gretl.

I think Jack's point was the other way round: the procedure you're talking could be interpreted in various ways so it's hard to know what count as "right". But having decided on that, it shouldn't be difficult to implement in gretl.

> I have noticed by now, that the omit command works on the unrestricted
> model only. I thought that using restrict command first, and then the
> omit command would apply the omit algorithm to the restricted model
> [...]

Your procedure illustrates why this is not possible in general. If the "omit" command drops a variable that participated in the prior restriction (e.g. that the coefficients sum to 1), then what is gretl supposed to do?

Rather than simply using "omit", you need to decide how you're going to respecify the restriction in case some terms are not statistically significant.

Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users at lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users

_______________________________________________
Gretl-users mailing list
Gretl-users at lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users

```