Unequal-cluster weighting in a cluster bootstrap (source code)

= Unequal-cluster weighting in a cluster bootstrap

<Unequal-cluster weighting in a cluster bootstrap> must preserve the statistic's intended population target while resampling the independent groups. For group $j$, let $n_j$ be its observed size, $T_j$ its observation sum, and $\overline X_j=T_j/n_j$. Two distinct estimates are
$$
\widehat\mu_{\rm row}=\frac{\sum_jT_j}{\sum_jn_j},\qquad
\widehat\mu_{\rm group}=\frac1K\sum_{j=1}^K\overline X_j.
$$
The first weights groups by their numbers of observations; the second gives each group equal weight. If group size is related to group response, the corresponding population targets need not agree. For identically distributed independent groups with suitable finite moments, they correspond to $E(T)/E(n)$ and $E(T/n)$, respectively.

For each <cluster bootstrap> replicate, draw $K$ group slots with replacement and recompute the selected statistic, including its denominator. The Stata manual explicitly notes that unequal group sizes cause replicate row counts to vary; keeping a fixed original row denominator would therefore compute a different statistic.<Bootstrap sampling and estimation in the Stata documentation>[Printed pp. 3–5, Options: size(), cluster(), and idcluster()]{ref}

For an original two-group example, take $A=(0)$ and $B=(10,10,10)$. The original pooled <sample mean> is $7.5$, while the equally weighted group-mean estimate is $5$. The four ordered two-group draws $AA,AB,BA,BB$ have equal probability. Their pooled <sample means> are $0,7.5,7.5,10$, whereas their equally weighted group-mean estimates are $0,5,5,10$.

Consequently the conditional bootstrap expectation of the pooled estimate is $6.25$, not $7.5$. This <bootstrap ratio bias with unequal cluster sizes> is visible with only two observed groups: averaging a random ratio does not generally give the ratio of the averages. It is not a reason to substitute the equally weighted estimate, which changes the estimand, or a claim that every large-group bootstrap is invalid.

Resampling groups in proportion to $n_j$ and then retaining all their rows introduces an additional size preference; that design needs its own justification. Replicated group copies also need distinct identifiers when the fitted model uses those identifiers. The correct resampling unit, the target mean, and the statistic recomputed in each draw must all be specified.