Trying to run a regression on several variables, as below:
local brain_volumes TIV_SPM BRAIN_SPM Brain_percent_TIV OrbitofrontalLEFTTIV OrbitofrontalRIGHTTIV SupraTempLEFTTIV SupraTempRIGHTTIV MedialParietalLEFTTIV MedialParietalRIGHTTIV LateralParietalLEFTTIV LateralParietalRIGHTTIV SensoryLEFTTIV SensoryRIGHTTIV MedialoccLEFTTIV MedialoccRIGHTTIV
foreach v of local brain_volumes {
bootstrap, reps(2000) seed(101): regress `v' c.AAS i.ScannerCategory
predict `v'_res, resid
summarize `v'_res
}
There is no error but nothing happens and the log just shows the command. I've tested each element outside of the loop, and they each work.
I've also tried:
foreach v of brain_volumes TIV_SPM BRAIN_SPM Brain_percent_TIV OrbitofrontalLEFTTIV OrbitofrontalRIGHTTIV SupraTempLEFTTIV SupraTempRIGHTTIV MedialParietalLEFTTIV MedialParietalRIGHTTIV LateralParietalLEFTTIV LateralParietalRIGHTTIV SensoryLEFTTIV SensoryRIGHTTIV MedialoccLEFTTIV MedialoccRIGHTTIV {
bootstrap, reps(2000) seed(101): regress `v' c.AAS i.ScannerCategory
predict `v'_res, resid
summarize `v'_res
}
which throws up "invalid syntax r(198);"
I've checked all the variables and they are correctly named and formatted.
I've used a very similar loop with a different variable list with no issues.
Any help troubleshooting would be really appreciated! Thank you!
local brain_volumes TIV_SPM BRAIN_SPM Brain_percent_TIV OrbitofrontalLEFTTIV OrbitofrontalRIGHTTIV SupraTempLEFTTIV SupraTempRIGHTTIV MedialParietalLEFTTIV MedialParietalRIGHTTIV LateralParietalLEFTTIV LateralParietalRIGHTTIV SensoryLEFTTIV SensoryRIGHTTIV MedialoccLEFTTIV MedialoccRIGHTTIV
foreach v of local brain_volumes {
bootstrap, reps(2000) seed(101): regress `v' c.AAS i.ScannerCategory
predict `v'_res, resid
summarize `v'_res
}
There is no error but nothing happens and the log just shows the command. I've tested each element outside of the loop, and they each work.
I've also tried:
foreach v of brain_volumes TIV_SPM BRAIN_SPM Brain_percent_TIV OrbitofrontalLEFTTIV OrbitofrontalRIGHTTIV SupraTempLEFTTIV SupraTempRIGHTTIV MedialParietalLEFTTIV MedialParietalRIGHTTIV LateralParietalLEFTTIV LateralParietalRIGHTTIV SensoryLEFTTIV SensoryRIGHTTIV MedialoccLEFTTIV MedialoccRIGHTTIV {
bootstrap, reps(2000) seed(101): regress `v' c.AAS i.ScannerCategory
predict `v'_res, resid
summarize `v'_res
}
which throws up "invalid syntax r(198);"
I've checked all the variables and they are correctly named and formatted.
I've used a very similar loop with a different variable list with no issues.
Any help troubleshooting would be really appreciated! Thank you!
Comment