I'm having trouble running the bootstrap over a user written command on panel data.
The example bellow replicates the error I get using xtreg on a balanced dataset.
How can I fix the error above, replicating the results of "xtreg y x, fe vce(bootstrap...)" with "bootstrap, cluster(id) idcluster(newid) : xtreg y x, fe ?"
More generally, how can I use the -bootstrap- command to sample by cluster without generating newid-year duplicates?
OBS: similar issues have been discussed in this tread, http://hsphsun3.harvard.edu/cgi-bin/...ticle-395.html, I did not find a definitive solution in it though.
The example bellow replicates the error I get using xtreg on a balanced dataset.
Code:
* simulate a dataset version 12.1 clear set seed 12345 set obs 200 gen id = _n gen ui = rnormal() expand 10 sort id bysort id: gen t = _n gen x = rnormal() gen y = ui +2*x + rnormal() xtset id t * bootstrapped clustered SEs xtreg y x, fe vce(bootstrap, seed(22)) cluster(id) * equivalent using -bootstrap- bootstrap, cluster(id) idcluster(newid) seed(22): xtreg y x, fe *Error: . repeated time values within panel . the most likely cause for this error is misspecifying the cluster(), . idcluster(), or group() option
How can I fix the error above, replicating the results of "xtreg y x, fe vce(bootstrap...)" with "bootstrap, cluster(id) idcluster(newid) : xtreg y x, fe ?"
More generally, how can I use the -bootstrap- command to sample by cluster without generating newid-year duplicates?
OBS: similar issues have been discussed in this tread, http://hsphsun3.harvard.edu/cgi-bin/...ticle-395.html, I did not find a definitive solution in it though.
Comment