Hello Statalisters,
I have an interesting problem that I figure someone can help me with. I'm looking to estimate a propensity score model and am attempting to design a simulation that tells me which specification of covariates achieves the best balance. My treatment indicator is binary {0,1} and I have a list of covariates x1,x2,...,xn. I would like to loop through my list of covariates and regress every possible combination of the covariates onto treatment condition; I will then want to store the R2 along with the covariate specification and isolate the covariate specification that achieves the highest R2.
I hope the below, while completely inaccurate code (more like pseudocode), helps clarify my thinking.
And then some way of identifying the model with the highest R2. Any thoughts people have would be appreciated!
I have an interesting problem that I figure someone can help me with. I'm looking to estimate a propensity score model and am attempting to design a simulation that tells me which specification of covariates achieves the best balance. My treatment indicator is binary {0,1} and I have a list of covariates x1,x2,...,xn. I would like to loop through my list of covariates and regress every possible combination of the covariates onto treatment condition; I will then want to store the R2 along with the covariate specification and isolate the covariate specification that achieves the highest R2.
I hope the below, while completely inaccurate code (more like pseudocode), helps clarify my thinking.
Code:
sysuse auto, clear local emptyx local covars foreign length rep78 price foreach var of local covars{ reg mpg `emptyx' `covars', r local R2 = e(r2) + `covars' }
Comment