I am using LASSO for inference. I want to independently assess the causality of 40 policy variables on a rate. Some of these vars are likely colinear. I would like to correct the loop below to: 1) automatically remove each x var from the control var pool when it is used as the variable of interest (I currently get an error message); 2) test for collinearity between the var of interest and each control x1-x40 and remove all collinears x1-x40 from the control pool for each regression. Note I have a handful of other control vars in that var pool that I do not want to subject to this restriction as I have a few quadratic terms.
Code:
foreach v of varlist x1-x40 { xpopoisson Mortality_rate `v', controls(rural gee cce fsi GDP_cap GDP_cap_sqr GHE_cap GHE_cap_sqr x1-x40) selection(cv) vce(cluster country_code) }
Robert
0 Response to dynamic looped regressions
Post a Comment