bootstrap resampling for hierarchical/multilevel data
问题 I am attempting to do bootstrap resampling on a multilevel/hierarchical dataset. The observations are (unique) patients clustered within hospitals. My strategy is to sample with replacement from the patients within each hospital in turn, which will ensure that all hospitals are represented in the sample and that when repeated all the samples sizes will be the same. This is method 2 here. My code is like this: hv <- na.omit(unique(dt$hospital)) samp.out <- NULL for (hosp in hv ) { ss1 <- dt[dt