Page 1 of 1

Dummy variables within a loop

Posted: Wed Aug 05, 2009 7:04 am
by arturobandini
Hi,

I'm estimating an equation (ch1.ls) within a loop for different values of a threshold (tau), which I model using dummy variables (d_ch1).

' Generate 99 different values for tau
smpl 1999M01 2009M03
for !j=1 to 99
tau(!j)=0.28667+!j*(3.19-0.28667)/100

' Generate corresponding dummy series
smpl 1999M01 2009M02
genr d_ch1=0
smpl if y > tau(!j)
genr d_ch1=1
smpl 1999M01 2009M02
stom(d_ch1,d_ch1_v)
colplace(dummies,d_ch1_v,!j)

' Estimate the model for each tau
smpl 1999M02 2009M03
equation ch1.ls y c(1)*d_ch1 c(1)*(1-d_ch1) x1*d_ch1 x1*(1-d_ch1) x2*d_ch1 x2*(1-d_ch1) x3*d_ch1 x3(1-d_ch1)
ch1.makeresids e_ch1
stom(e_ch1,e_ch1_v)
colplace(resids,e_ch1_v,!j)


I need consistent residuals series (e_ch1) out of these because I have to bootstrap them afterwards. The problem is that the residuals series I get look rather awkward. More precisely, the 99 series always seem to follow the same pattern: the first series looks ok, the next one is strange (high, negative values), the next one looks ok, the next one is strange, etc...

I'm wondering: is it because of the way I programmed the equation with dummies in the equation above? Or could it be related to the preceeding steps?

I've been fighting with this for a few hours so any advice would be deeply appreciated! If you would like to have a look at the residuals, I can easily upload them...
Thx a lot...