Hello,
I am stumped on a coding problem. I am measuring the treatment effect on each of multiple outcomes over each of multiple treatments for each of multiple groups in my data set. I am using the canned teffects commands. Unfortunately, some groups have perfect predictors included for some variables, but others do not for those same variables. For each group I want to include as many covariates as possible from the full set. Further, my data set will be updated periodically and bins that are currently 0 may become non-zero in the future (so I need code that is dynamic enough to pick up on the changing data with each future iteration). The problem is that teffects outs when a perfect predictor is included, rather than omitting that variable. So, I want to create a loop that will
1. preserve the data
2. run the logit model with full set of covariates, many of which are categorical factor variables
3. detect perfect predictors from #2
4. run teffects while omitting perfect predictors detected in #3
5. restore the data
I'm good with 1,2,5, but I don't know how (or if there's a way) to code 3-4. Any help on this is greatly appreciated
On a side note, I understand why teffects outs when including perfect predictors and I tend to agree with the reasoning for balanced data sets and one-off runs of teffects. But my situation is a little different. To this end, I have sent a technical request to Stata to include a non-default option to run the model while omitting perfect predictors and providing a note in the output to that effect, as happens elsewhere in Stata.
Michael
Related Posts with teffects loops, inconsistent covariate coverage, and perfect predictors
Calculating 95% CI for a chi square analysis?If I'm looking for how a category "treatment type" affects category "diagnosis" in a 2x2 chi square …
'SWEXP': piecewise exponential distribution functionI thank Kit for making a command swexp available on SSC. This command calculates quantities from a …
Using value labels in graphs through loopsHi all, I am trying to create a graph of weekly_count_visittype (Y axis) and week_num (X axis) separ…
How to use the results of LCA(Latent Class Analysis) in the next step of regression analysis?Hello! I used gsem to perform an LCA analysis and separated the categories. How can I use this cate…
How to reset a loop with a continues set of codes?Hi everyone, I hope you are doing well. I'm posting here because I have a doubt regarding a loop I'…
Subscribe to:
Post Comments (Atom)
0 Response to teffects loops, inconsistent covariate coverage, and perfect predictors
Post a Comment