The number of clusters required for the CRT giving a power of .8, .9 or .95 is inluenced by 1) the number of students in a cluster (n), the intra class correlation (icc) the effect size (Cohen’s d) and the explained variance by the covariates on cluster level (rho.Xj). Below plots are shown for n=20,30, icc=.09, icc=.2, icc=.4, icc=.6 and rho.Xj=0.1 (age seems to explain some variance). Attrition level is 0% or 5%.
delta<-function(power,J,n,icc,rho.Xj,attrition){
J.attr=J*(1-attrition)
icc.cov=(1-rho.Xj^2)/((1-rho.Xj^2)+((1-icc)/icc))
ncp=abs(qt(1-power,df=J.attr-2)+-qt(0.975,df=J.attr-2))
delta=sqrt((ncp^2*(4*(icc.cov+(1-icc.cov)/n)))/J.attr)
return(delta)}