I was redirected from Stackoverflow here by Nick Cox with the following question:
I want to run stepwise on a linear probability model with time and individual fixed effects in a panel dataset but stepwise does not support panels out of the box. The solution is to run xtdata y x, fe followed by reg y x, r . However, the resulting standard errors are too small. One attempt to solve this problem can be found here: http://www.stata.com/statalist/archi.../msg00629.html but my panel is highly unbalanced (I have a different number of observations for different variables). I also don't understand how stepwise would include this information in its iterations with different variable lists. Since stepwise bases its decision rules on the pvals, this is quite crucial.
Reproducible Example:
As you can see, the estimates are fine but I need to adjust the standard errors. Also, I need to do that in such a way that stepwise understands in its iterations when the number of variables changes, for example. Any help on how to proceed?
I want to run stepwise on a linear probability model with time and individual fixed effects in a panel dataset but stepwise does not support panels out of the box. The solution is to run xtdata y x, fe followed by reg y x, r . However, the resulting standard errors are too small. One attempt to solve this problem can be found here: http://www.stata.com/statalist/archi.../msg00629.html but my panel is highly unbalanced (I have a different number of observations for different variables). I also don't understand how stepwise would include this information in its iterations with different variable lists. Since stepwise bases its decision rules on the pvals, this is quite crucial.
Reproducible Example:
Code:
webuse nlswork, clear /*unbalancing a bit:*/ replace tenure =. if year <73 replace hours =. if hours==24 | hours==38 replace tenure =. if idcode==3 | idcode == 12 | idcode == 19 xtreg ln_wage tenure hours union i.year, fe vce(robust) eststo xtregit /*this is what I want to reproduce without xtreg to use it in stepwise */ xi i.year /* year dummies to keep */ xtdata ln_wage tenure hours union _Iyear*, fe clear reg ln_wage tenure hours union _Iyear*, vce(hc3) /*regression on transformed data */ eststo regit esttab xtregit regit
Comment