1
$\begingroup$

I would welcome any help with computing power calculations for cluster randomised control trial and specifying the code in R for this. I've been trying to use clusterPower package but any R package would do. Example below.

Design

The clusters are individual schools but the outcome variable occurs at participant level (parents). Most schools have around 500 - 1000 pupils but my study will likely have very low response rate. I'd expect 18%, hence roughly 90 pupils from school of 500 pupils but of those only some will be eligible as they need to be of a specific age. So I'd be guessing half that number, i.e. 45 at most for some of the schools. The respondents are parents but I am assuming parent pupil ratio 1:1.

What I'd like to do is to randomly select schools from roughly 300 - 400 schools, and then randomly assign intervention or control stimuli. I am expecting low effect size, for example beta = 0.02 - 0.1. The clusters will surely vary but I am clueless about degree of the variation. You can imagine all sorts of things contributing to this (from deprivation to school size itself).

The outcome variable will be continuous and binary. One will measure mean satisfaction, the other attendance (Yes/No).

I've tried to simulate the binary outcome using the code below. This comes from the following article. It's adapted example from the authors of clusterPower. The simulation will run, although I am unsure if this is correct and I wasn't able to plot the results.

install.packages("clusterPower")
library(clusterPower)
set.seed(17)

    es <- rep(c(.05, .1), each = 5*3)
    br <- rep(rep(c(.5,.6,.7), each = 5), 3)
    ns <- rep(c(36, 54, 72), 3*3) # using max response rate of 18%
    powr <- numeric(length = length(ns))
    for(i in 1:length(ns)) {
         or <- (br[i]+es[i])*(1-br[i])/(br[i]*(1-br[i]-es[i]))
         p.try <- power.sim.binomial(n.sim = 250, effect.size=log(or), alpha =.05,
                                     n.clusters = 6, n.periods = 1,
                                     cluster.size=ns[i],
                                     period.effect = br[i], period.var = 0,
                                     btw.clust.var = .005, verbose = TRUE,
                                     estimation.function=fixed.effect)
         powr[i] <- p.try$power
    }

Thank you for any suggestions for how to run this simulation in clusterPower, or another package.

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.