Dear all,
For a research project I am trying to create a code to do an out-of-sample regression.
This out-of-sample regression has to be done for 7 different variables, and, therefore, also contains a loop for these 7 variables.
I want this regression to start using the first 240 observations.
forvalues i=1(1)7 {
forvalues t=240(1) 'T-1'{
reg y x`i', if inrange (time, 1, 't')
mat tbl=r(table)
mat b`i'=tbl[1,1]
mat t`i'=tbl[3,1]
mat rsq`i'=e(r2)
}
}
I keep getting "syntax invalid", but I'm not sure where the error in the code is. Anyone ideas?
For a research project I am trying to create a code to do an out-of-sample regression.
This out-of-sample regression has to be done for 7 different variables, and, therefore, also contains a loop for these 7 variables.
I want this regression to start using the first 240 observations.
forvalues i=1(1)7 {
forvalues t=240(1) 'T-1'{
reg y x`i', if inrange (time, 1, 't')
mat tbl=r(table)
mat b`i'=tbl[1,1]
mat t`i'=tbl[3,1]
mat rsq`i'=e(r2)
}
}
I keep getting "syntax invalid", but I'm not sure where the error in the code is. Anyone ideas?
Comment