I'm trying to figure out how to calculate clustered standard errors via boostrap when the clusters are nested. I know that when there is a single level of clustering, you sample at the cluster level rather than at the individual level. Any idea what you do when there are multiple nested levels?

To be more concrete, let's say I'm analyzing student performance and I have country-level data. In this context, I may want to cluster by state, city, and school.


1 Answer 1


I believe you are looking for the bootcov function in R that allows calculations of standard errors for nested clusters. This is well described in Huang 2016, you should have a look at the examples they give in the supplementary materials where they provide the full R script they used for this analysis.

Huang, Francis L. "Using cluster bootstrapping to analyze nested data with a few clusters." Educational and Psychological Measurement (2016): 0013164416678980.

Using a Monte Carlo simulation that varied the number of clusters, average cluster size, and intraclass correlations, we compared standard errors using cluster bootstrapping with those derived using ordinary least squares regression and multilevel models. Results indicate that cluster bootstrapping, though more computationally demanding, can be used as an alternative procedure for the analysis of clustered data when treatment effects at the group level are of primary interest. Supplementary material showing how to perform cluster bootstrapped regressions using R is also provided.


  • 1
    $\begingroup$ Thanks. Had a look and this is still only for the case where there is a single level of clustering. My question is for when there are multiple levels of clusters that are nested. $\endgroup$
    – Luke
    Feb 19, 2018 at 17:40
  • $\begingroup$ Sorry didn't realize that, maybe you'd have more chance on the programming forum as it doesn't look like there is any package currently available. $\endgroup$
    – Nakx
    Feb 19, 2018 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.