I'm trying to do an analysis of covariance (ANCOVA) for a sample of all non-financial firms for the period 1985-2003. As output, I want to compute the Type III partial sum of squares for each effect in the model, where after normalizing each estimate by the sum across the effect.
However, because of the large number of firms and memory limitations, I want to randomly sample 10% of the firms in the panel, perform the analysis on this subsample and repeat this process 100 times, averaging the results. I managed to do it once using the following code:
Code:
tempfile paneldata save `paneldata' collapse (mean) book_leverage, by(gvkey) keep gvkey sample 10 tempfile randomsample save `randomsample' use `paneldata' merge m:1 gvkey using `randomsample' drop if _merge == 1 drop _merge
Please let me know if something is not clear!
Thanks in advance,
Koen
0 Response to repeating random sample and averaging the results
Post a Comment