I have written a program which should allow me to test a number of extra variables when added to a base regression specification, returning the t values for each specification when estimated in a matrix. It sometimes seems to work, but is very sensitive, and often comes up with the following error: 'Syntax Error in for %k [then a list of the variable names]' Do you have any idea why this might be?
Code: Select all
%dep = "" ' variable to store name of dependent variable
%regs = "c " ' variable to store list of regressors. Default is "c" for a constant.
%extra ="" 'variable to store test regressors
!result = 0 ' variable that will track the result of dialogs. -1 indicates user hit Cancel. 0 Indicates user hit OK.
!result = @uidialog("Caption", "Additional Regressor Tester", "edit", %dep,"Enter the dependent variable", 300, "edit", %regs, "Enter the list of initial regressors", 10000, "edit", %extra,"Enter the list of regressors you would like to test",10000) ' put up an Edit dialog asking for dependent variable.
if !result=-1 then 'if user cancelled, then stop program
stop
endif
string a = %extra
group q_exreg
group q_reg
!j=0
for %k {%extra}
q_exreg.add {%k}
next
for %l {%regs}
q_reg.add {%l}
next
matrix(q_reg.@count+1, q_exreg.@count) q_tstat
for %i {%extra}
!j = !j + 1
equation q_eqa_{%i}.ls {%dep} {%regs} {%i}
colplace(q_tstat, q_eqa_{%i}.@tstats, !j)
next
Thanks,
Ben
