I am seeking to implement the control function approach in the context of a multi-level model.
Individuals are nested in Geo1 and Geo2; it is a cross-classified model.
The heavily stylized example below builds on this earlier post: https://www.statalist.org/forums/for...ction-approach
The minimum workable example uses somewhat arbitrarily chosen variable to illustrate my main challenge: Geo1 variation needs to be captured by fixed effects, the variable of interest is at the Geo2 level, where, to account for the clustered nature of the data, I use a random effect. When bootstrapping the two stages, because of the fixed effects, many bootstraps are bound to fail. While in principle all fixed effects can be estimated on the entire sample, once Geo2/RE units are bootstrapped not all fixed effects can be estimated anymore and this particular bootstrap fails (see below).
The bootstraps that fail are non-random (i.e. depend on some Geo2/RE characteristics), hence, I don't think I can trust the bootstrapped results.
What would you advice me to do?
Thank you very much in advance!
Code:
sysuse auto, clear rename rep78 y replace y = 0 if y <= 3 replace y = 1 if y > 3 rename weight x rename length z gen n = _n xtile FE = n, nq(5) // GEO1 identifier as fixed effect drop n xtile RE = trunk, nq(10) // GEO2 identifier as random effect egen pickone = tag(RE) bysort RE: egen mean_g = mean(gear_ratio) // independent variable at GEO2-level for illustration *bootstrap CF approach program CF reg x z headroom if pickone // first stage with instrument (in the real data only Geo2/RE-level data enter, hence the if pickone) predict x_res, residuals melogit y x headroom mean_g i.FE x_res || RE: // second stage drop x_res end program bootstrap, reps(20) cluster(RE) idcluster(ID) seed(123) force: CF program drop CF
Bootstrap replications (1000) | |
1 ---+--- 2 ---+--- 3 ---+--- 4 ---+- | - 5 |
x.....x.x..xx.xxxxxxxx..x.xxx.x.x..x.x.x.....x |
0 Response to Bootstrapping multi-level logit model with endogenous predictor using control function (Wooldridge): Handling fixed effects in bootstrap
Post a Comment