# Mediation with data from cluster RCT

I am using the R mediate package to look at mechanisms of change in a cluster randomized controlled trial. My code looks somewhat like this:

model.m <- lm(efficacy_C3 ~ TrialArm +  Age_CT1a + female +rural  + married  +Work1_CT1a + GrantIncomeCap + highschool + asset_pca_CT1, data=STS_Data)
model.y <- lm(econbeh_C3~ TrialArm + efficacy_C3+ econbeh_C1 + Age_CT1a + female +rural + married  +Work1_CT1a + GrantIncomeCap + highschool + asset_pca_CT1, data=STS_Data)

### Non parametric
out.1 <- mediate(model.m, model.y, sims = 1000,
boot = TRUE, treat = "TrialArm", mediator = "efficacy_C3", cluster = "ClusterID_AT1a")


In out.1 I try to cluster my standard errors to account for the fact that villages rather than individuals were randomized. But R gives me the following error message: "'cluster' is ignored for nonparametric bootstrap " Any idea how I can address this? Thank you!

• The nonparametric bootstrap refers to when boot = TRUE. Maybe set it to FALSE and see if that helps?
– Noah
May 25 '18 at 20:41