I am trying to run iterative regressions. The code works for the full sample. However, I have now introduced a dummy variable called ANN which takes value 1 or 0. I want to run the regressions only on the subset where ANN takes value 1. I thought the best approach would be to use an IF statement, basically saying that if the variable takes value 1 to include that in the iterative regressions.
The code I am trying is this but it doesn't work:
Code: Select all
'create matrix to store coefficients. We'll be running 15 regressions (so 15 columns) with two coefficients in each, so two rows
matrix(2,61) coefs
matrix(2,61) stderrs
'create empty equation to be used inside the loop
equation eq
if ann=1
'run pairwise regressions between Y and each X
for !i=0 to 60
'estimate equation
eq.ls(cov=hac) gbpusd c ois_{!i}m
'store coefficients into matrix
colplace(coefs, eq.@coefs, !i+1)
colplace(stderrs, eq.@stderrs, !i+1) 'std errs
next
endif
