---
title: Similarity-Weighted Bayesian Bootstrap
url: https://www.emergentmind.com/topics/similarity-weighted-bayesian-bootstrap-swbb
type: topic
---

# Similarity-Weighted Bayesian Bootstrap

Similarity-Weighted Bayesian Bootstrap (SWBB) is a modification of Rubin’s Bayesian bootstrap tailored to clustered data and, specifically, to causal mediation in cluster randomized trials (CRTs) with a small number of clusters and a cluster-level mediator. In the semiparametric framework developed for causal mediation in CRTs, SWBB models the joint distribution of cluster-level and individual-level confounders nonparametrically, while outcome and mediator regressions remain parametric. Its distinguishing feature is an explicit similarity-based information-borrowing mechanism across clusters, implemented through distance-dependent Dirichlet weights, so that inference borrows more from confounder profiles that are closer in covariate space [2606.13305].

## 1. Definition and scope

The classical Bayesian bootstrap represents an unknown distribution \(F\) as a discrete distribution supported on the observed values, with random Dirichlet weights. In the SWBB construction, that nonparametric representation is retained, but it is applied not to the full data distribution but to the joint distribution of the confounders \((\mathbf{C},\mathbf{V})\), where \(\mathbf{V}_j\) denotes the cluster-level confounder vector for cluster \(j\) and \(\mathbf{C}_{ji}\) denotes the individual-level confounder vector for individual \(i\) in cluster \(j\) [2606.13305].

SWBB extends the standard Bayesian bootstrap in three ways. First, it maintains a discrete support on the observed confounders. Second, it introduces a distance metric \(d_{lj}\) between clusters \(l\) and \(j\), which encodes an explicit similarity-based information-borrowing mechanism across clusters. Third, it uses this distance to define Dirichlet priors on cluster-to-cluster weights
\[
\omega_{j\mid(l)} = P(\mathbf{C}\in\mathcal{C}_{[j]}\mid \mathbf{V}=\mathbf{V}_l),
\]
so that a target cluster \(l\) can borrow confounder information from all observed clusters, but more strongly from clusters deemed closer in covariate space.

This construction is meant to address a specific inferential problem. In CRT mediation settings with a small number of clusters, asymptotic variance approximations can be unreliable, fully parametric models for \(P(\mathbf{C},\mathbf{V})\) can be unstable or misspecified, and cluster-specific empirical distributions can be too noisy when within-cluster confounder variation is limited. SWBB is designed to remain conjugate and computationally simple while reducing variance by borrowing strength primarily from similar clusters [2606.13305].

## 2. Hierarchical formulation and similarity mechanism

The SWBB factorization begins from the modeling device
\[
\{\mathbf{C}_{ji}\perp \mathbf{V}_l \mid \mathbf{C}\in\mathcal{C}_{[j]}\},
\]
under which, for an observed pair \((\mathbf{C}=\mathbf{c}_{ji},\mathbf{V}=\mathbf{v}_l)\),
\[
P(\mathbf{C}=\mathbf{c}_{ji},\mathbf{V}=\mathbf{v}_l)
=
P(\mathbf{V}=\mathbf{v}_l)\,
P(\mathbf{C}\in\mathcal{C}_{[j]}\mid \mathbf{V}=\mathbf{v}_l)\,
P(\mathbf{C}=\mathbf{c}_{ji}\mid \mathbf{C}\in\mathcal{C}_{[j]}).
\]
Each factor is modeled with BB-type Dirichlet weights [2606.13305].

At the cluster level,
\[
P_{\mathcal{V}}(d\mathbf{v})=\sum_{l=1}^J \rho_l\,\delta_{\mathbf{V}_l}(d\mathbf{v}),
\qquad
\boldsymbol{\rho}\mid \mathcal{V}\sim \text{Dirichlet}(\mathbf{1}_J).
\]
Within a donor cluster \(j\),
\[
P_{\mathcal{C}_{[j]}}(d\mathbf{c})=\sum_{i=1}^{n_j}\pi_{i\mid(j)}\,\delta_{\mathbf{C}_{ji}}(d\mathbf{c}),
\qquad
\boldsymbol{\pi}_{(j)}\mid \mathcal{C}_{[j]}\sim \text{Dirichlet}(\mathbf{1}_{n_j}).
\]
The novel component is the inter-cluster allocation
\[
\omega_{j\mid(l)}=P(\mathbf{C}\in\mathcal{C}_{[j]}\mid \mathbf{V}=\mathbf{v}_l),
\]
for which SWBB places a Dirichlet prior with base measure proportional to a similarity vector derived from pairwise cluster distances [2606.13305].

The distance is
\[
d_{lj}
=
\exp\left\{
-\frac{1}{\chi}\big(\zeta\,\xi_{lj}^{\mathbf{V}}+(1-\zeta)\,\xi_{lj}^{\mathbf{C}}\big)
\right\},
\qquad
\chi>0,\ \zeta\in[0,1].
\]
Here, \(\xi_{lj}^{\mathbf{V}}\) is the average pairwise distance in the cluster-level confounder space, and \(\xi_{lj}^{\mathbf{C}}\) is the average pairwise distance between the individual-level confounder sets of clusters \(l\) and \(j\), using a standard norm such as \(L_1\) or \(L_2\). The parameter \(\zeta\) controls the relative importance of cluster-level and individual-level distances, whereas \(\chi\) controls how quickly similarity decays. As \(\chi\to 0\), cross-cluster borrowing becomes negligible and SWBB approaches the standard Bayesian bootstrap; for larger \(\chi\), borrowing becomes more global [2606.13305].

A useful interpretation is obtained by defining
\[
\eta_{lj}^\omega = \alpha_l^\omega d_{lj},
\qquad
\alpha_l^\omega = \frac{N}{n_l\tau^\omega}.
\]
The quantity \(\eta_{lj}^\omega\) is interpreted as the number of “pseudo-subjects” contributed from cluster \(j\) to the conditional confounder distribution for target cluster \(l\). Under this scaling, smaller target clusters receive more pseudo-subjects, and among potential donor clusters, those with higher similarity contribute more. This generalizes the hierarchical Bayesian bootstrap (HBB), whose borrowing weights depend only on sample sizes rather than similarity [2606.13305].

The resulting joint discrete distribution can be written as
\[
P(\mathbf{C}=\mathbf{c}_{ji},\mathbf{V}=\mathbf{v}_l)
=
\rho_l\,\omega_{j\mid(l)}\,\pi_{i\mid(j)}.
\]
Accordingly, SWBB is a nonparametric prior on the joint empirical distribution of multilevel confounders with a hierarchical structure:
\[
P(\mathbf{V})=\sum_l \rho_l\delta_{\mathbf{V}_l},
\qquad
P(\mathbf{C}\mid \mathbf{V}=\mathbf{v}_l)
=
\sum_j \omega_{j\mid(l)}\sum_i \pi_{i\mid(j)}\delta_{\mathbf{C}_{ji}}.
\]

## 3. Place within semiparametric causal mediation

The observed data are
\[
\{Y_{ji},M_j,Z_j,\mathbf{V}_j,\mathbf{C}_{ji}\},
\]
with treatment \(Z_j\), cluster-level mediator \(M_j\), and individual-level outcome \(Y_{ji}\). The framework combines SWBB for the confounder distribution with parametric regression models for the mediator and outcome. The outcome model is a generalized linear mixed model,
\[
\mathbb{E}[Y_{ji}\mid M_j,Z_j,\mathbf{V}_j,\mathbf{C}_{ji};\psi_j,\boldsymbol{\theta}^y]
=
g_Y^{-1}\!\left(\mathbf{X}_{ji}^y\boldsymbol{\theta}^y+\psi_j\right),
\]
with \(\mathbf{X}_{ji}^y=(1,M_j,Z_j,\mathbf{V}_j,\mathbf{C}_{ji})\) and \(\psi_j\sim\mathcal{N}(0,\sigma_\psi^2)\). The mediator model is a cluster-level generalized linear model,
\[
\mathbb{E}[M_j\mid Z_j,\mathbf{V}_j,\overline{\mathbf{C}_j};\boldsymbol{\theta}^m]
=
g_M^{-1}\!\left(\mathbf{X}_j^m\boldsymbol{\theta}^m\right),
\]
with \(\mathbf{X}_j^m=(1,Z_j,\mathbf{V}_j,\overline{\mathbf{C}_j})\). The overall procedure is therefore semiparametric: \(Y\mid(M,Z,\mathbf{C},\mathbf{V})\) and \(M\mid(Z,\mathbf{V},\overline{\mathbf{C}})\) are parametric, while \(P(\mathbf{C},\mathbf{V})\) is modeled nonparametrically through SWBB [2606.13305].

The causal estimands are the natural indirect effect (NIE) and natural direct effect (NDE). At the population level,
\[
\text{NIE}=\mathbb{E}[Y(1,M(1))-Y(1,M(0))],
\qquad
\text{NDE}=\mathbb{E}[Y(1,M(0))-Y(0,M(0))].
\]
Identification is based on cluster-level SUTVA, sequential ignorability with baseline confounders \((\mathbf{C},\mathbf{V})\), and positivity. In CRTs with cluster randomization, the exposure ignorability condition is guaranteed by design [2606.13305].

Under these assumptions, nested potential outcomes are identified by the mediation formula. At the population level,
\[
\mathbb{E}[Y(z,M(z'))]
=
\iiint
\mathbb{E}[Y\mid M=m',Z=z,\mathbf{C}=\mathbf{c},\mathbf{V}=\mathbf{v}]
\,dF_{M\mid Z=z',\mathbf{C}=\mathbf{c},\mathbf{V}=\mathbf{v}}(m')
\,dF_{\mathbf{C}\mid \mathbf{V}=\mathbf{v}}(\mathbf{c})
\,dF_{\mathbf{V}}(\mathbf{v}).
\]
SWBB supplies the nonparametric \(F_{\mathbf{C},\mathbf{V}}\), and hence \(F_{\mathbf{V}}\) and \(F_{\mathbf{C}\mid\mathbf{V}}\), that enter these integrals. In this sense, SWBB occupies the confounder-distribution component of the mediation functional rather than the outcome or mediator regression component [2606.13305].

## 4. Computational implementation

The implementation proceeds within MCMC. At each iteration, cluster-level weights \(\boldsymbol{\rho}\) are drawn from \(\text{Dirichlet}(\mathbf{1}_J)\), inter-cluster weights \(\boldsymbol{\omega}_{(l)}\) are drawn from their posterior Dirichlet distributions using precomputed distances \(d_{lj}\), and within-cluster weights \(\boldsymbol{\pi}_{(j)}\) are drawn from \(\text{Dirichlet}(\mathbf{1}_{n_j})\). These draws determine the discrete approximation
\[
P^{(d)}(\mathbf{C}=\mathbf{c}_{ji},\mathbf{V}=\mathbf{v}_l)
=
\rho_l^{(d)}\omega_{j\mid(l)}^{(d)}\pi_{i\mid(j)}^{(d)}.
\]
Mediator and outcome model parameters are then sampled by standard MCMC; the paper notes implementation via Stan or similar, but does not spell out the exact sampler [2606.13305].

Potential mediators are simulated from the mediator model, often using either the GLM predictive mean or a draw from the predictive distribution. The mediation functionals are then computed as weighted sums over the SWBB support points. For example, the population-level nested potential outcome is approximated by summing over cluster-level weights, inter-cluster borrowing weights, and within-cluster empirical weights, with the parametric outcome regression evaluated at the sampled or plug-in mediator value. NDE, NIE, and ATE are obtained at each iteration as differences of nested potential outcomes, and posterior summaries are formed from the resulting draws [2606.13305].

In the reported implementation, 4,000 iterations are used, with 2,000 discarded as burn-in. The principal computational costs are the one-time computation of pairwise \(\xi_{lj}^{\mathbf{C}}\), which is \(O(J^2\bar{n}^2 p_{\mathbf{C}})\) naively, and the MCMC for the parametric models. With \(J=24\) and moderate cluster sizes, the approach is described as tractable [2606.13305].

## 5. Empirical behavior in simulations and in the BIGPIC trial

The simulation study uses 1,000 datasets per scenario with \(J=24\) clusters and \(n_j=100\) individuals per cluster. Treatment is randomized as \(Z_j\sim\text{Bernoulli}(0.5)\). Cluster-level confounders consist of three variables, and individual-level confounders have six components with a mix of binary and continuous variables. Three scenarios are considered: \(\mathbf{V}\perp\mathbf{C}\), weak dependence, and strong dependence. Under the chosen structural models, the true NIE, NDE, and ATE are \(1.0\), \(1.0\), and \(2.0\), respectively [2606.13305].

Across these scenarios, bias is essentially \(0\) for all methods, so BB, HBB, and SWBB are all approximately unbiased. The primary difference appears in RMSE. For NIE and ATE, SWBB attains lower RMSE than BB and HBB, especially for \(\chi\ge 1\). In the independence scenario, NIE RMSE decreases from \(0.85\) under BB to \(0.81\) under SWBB with \(\chi=1\), about a \(5\%\) improvement; ATE RMSE decreases from \(0.91\) to \(0.87\), about a \(4\)–\(5\%\) improvement. In the strong-dependence scenario, NIE RMSE again decreases from \(0.85\) to \(0.81\). For NDE, RMSE differences are minimal, which the paper attributes to the linear mixed-model structure, under which the direct effect behaves like an intercept shift and is less sensitive to uncertainty in the confounder distribution. Coverage probabilities for nominal \(95\%\) intervals remain around \(0.95\)–\(0.97\) for all estimands and methods. Very small \(\chi\) produces RMSE close to BB, increasing \(\chi\) to approximately \(1\) lowers RMSE, and larger values such as \(10\) or \(100\) produce little further change. Changing \(\zeta\) has minor influence in these simulations, and \(\zeta=0.5\) is recommended [2606.13305].

The empirical application is the BIGPIC CRT in Western Kenya, comprising \(J=24\) health facility clusters randomized to four arms: usual care, usual care plus microfinance, group medical visits, and group medical visits plus microfinance. The outcome is 1-year change in systolic blood pressure. The mediator is a cluster-level sociometric network summary at 12 months, with density, transitivity, cohesion, and average path length analyzed separately. Pairwise treatment contrasts are constructed as GMV given MF and MF given GMV. Individual-level confounders include age, gender, livestock ownership, employment status, diabetes status, and cluster-centered baseline systolic blood pressure. Cluster-level confounders include county, facility type, baseline GISE, the cluster mean of baseline systolic blood pressure, and the cluster-level means of the individual-level confounders. In practice, SWBB is used with \(\chi=1\), \(\zeta=0.5\), and \(\tau^\omega=1\) [2606.13305].

For both treatment comparisons and all four mediators, the population-level NIE, NDE, and ATE have \(95\%\) credible intervals that include \(0\), so the analysis does not find evidence of statistically significant mediation or total effects through these network summaries. SWBB nevertheless yields narrower credible intervals than BB and HBB without altering the substantive conclusion. For the comparison UC-MF versus GMV-MF with density as mediator, the ATE interval length is \(5.48\) under BB, \(5.51\) under HBB, and \(4.29\) under SWBB, approximately \(22\%\) shorter for SWBB. Similar reductions of approximately \(20\)–\(22\%\) are reported for NIE and ATE across mediators in both pairwise comparisons, with more modest reductions for NDE. Conditional analyses stratified by GISE or diabetes status produce wider intervals because of smaller effective sample sizes, but SWBB still gives the most precise estimates among the three bootstrap methods [2606.13305].

## 6. Assumptions, limitations, and relation to adjacent bootstrap methods

Beyond the usual causal assumptions, SWBB relies on several modeling assumptions. The discrete support on observed confounders implies an exchangeability-type requirement: the observed clusters and individuals are taken to represent the target population. The factorization uses the independence condition \(\mathbf{C}_{ji}\perp \mathbf{V}_l\mid \mathbf{C}\in\mathcal{C}_{[j]}\) as a modeling device to separate within-cluster and cross-cluster components. The distance \(d_{lj}\) must be a reasonable proxy for similarity in the true confounder distributions, and the tuning parameters \(\chi\), \(\zeta\), and \(\tau^\omega\) are fixed rather than learned. The method also inherits the limitation that it can only extrapolate within the observed covariate support, not beyond it. The current implementation is single-mediator, and the mediator model is deliberately kept parametric for stability with few clusters [2606.13305].

The paper suggests several extensions: combining SWBB with more flexible outcome and mediator models such as BART, DP mixtures, or nested dependent DPs; extending SWBB to smoothed Bayesian bootstrap variants; developing sensitivity analyses for violations of sequential ignorability; and moving to multiple or time-varying mediators under weaker identification assumptions. These are proposed directions rather than implemented components [2606.13305].

A concise comparison clarifies where SWBB sits among adjacent methods.

| Method | Weighting mechanism | Distinguishing feature |
|---|---|---|
| BB | Dirichlet weights on observed support | No cross-cluster borrowing |
| HBB | Cross-cluster borrowing tied to sample sizes | Can over-borrow from large but dissimilar clusters |
| SWBB | Distance-based Dirichlet borrowing weights | Borrowing targeted to similar clusters |
| WBB / CWBB | Random weights in the log-likelihood objective | Optimization-based approximate posterior sampling |

The distinction between SWBB and the weighted Bayesian bootstrap terminology used elsewhere is important. In the constrained weighted Bayesian bootstrap literature, “weighted Bayesian bootstrap” refers to Newton and Raftery’s optimization-based sampler: random Dirichlet- or exponential-derived weights are placed directly on the log-likelihood, and each weighted optimization yields an approximate posterior draw. That framework is parametric or semiparametric, its weights are independent of the data, and it does not implement similarity-based weighting [2606.04237]. By contrast, SWBB is a BB-type prior on the empirical confounder distribution itself, with explicit distance-based borrowing across clusters [2606.13305].

Relative to broader nonparametric Bayes, SWBB is more modest than Dirichlet process mixtures because it keeps the support fixed at observed confounders and randomizes only the weights. This suggests a tradeoff emphasized in the source material: exact conjugacy and computational simplicity are retained, while latent mixture structure is not modeled. The paper is methodological and empirical rather than asymptotic; explicit asymptotic theorems are not developed for SWBB. A plausible implication is that its finite-sample appeal, particularly in small-\(J\) CRTs, rests less on large-sample theory than on the combination of exact Dirichlet updating for the confounder distribution, semiparametric causal identification, and the observed simulation evidence for nominal coverage and reduced RMSE [2606.13305].

Source: https://www.emergentmind.com/topics/similarity-weighted-bayesian-bootstrap-swbb