# NOT RUN {
# cross-checks for the main effect
mdes.cra3(rho3=.06, rho2=.17, n=15, J=3, K=60)
power.cra3(es=.269, rho3=.06, rho2=.17, n=15, J=3, K=60)
mrss.cra3(es=.269, rho3=.06, rho2=.17, n=15, J=3)
# cross-checks for the randomly varying cont. L1 moderator effect
mdesd.mod331(power=.80, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=.10, omegam3=.10,
q=NULL, n=15, J=3, K=60)
power.mod331(es=0.1248, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=.10, omegam3=.10,
q=NULL, n=15, J=3, K=60)
mrss.mod331(es=0.1248, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=.10, omegam3=.10,
q=NULL, n=15, J=3)
# cross-checks for the non-randomly varying cont. L1 moderator effect
mdesd.mod331(power=.80, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=0, omegam3=0,
q=NULL, n=15, J=3, K=60)
power.mod331(es=.0946, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=0, omegam3=0,
q=NULL, n=15, J=3, K=60)
mrss.mod331(es=.0946, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=0, omegam3=0,
q=NULL, n=15, J=3)
# cross-checks for the randomly varying bin. L1 moderator effect
mdesd.mod331(power=.80, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=.10, omegam3=.10,
q=.50, n=15, J=3, K=60)
power.mod331(es=.2082, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=.10, omegam3=.10,
q=.50, n=15, J=3, K=60)
mrss.mod331(es=.2082, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=.10, omegam3=.10,
q=.50, n=15, J=3)
# cross-checks for the non-randomly varying bin. L1 moderator effect
mdesd.mod331(power=.80, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=0, omegam3=0,
q=.50, n=15, J=3, K=60)
power.mod331(es=.1893, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=0, omegam3=0,
q=.50, n=15, J=3, K=60)
mrss.mod331(es=.1893, alpha=.05, two.tailed=TRUE,
rho2=.17, rho3=.06, omegam2=0, omegam3=0,
q=.50, n=15, J=3)
# cross-checks for the randomly varying bin. L2 moderator effect
mdesd.mod332(rho3=.1, rho2=.1, omegam3=.05,
q=.5, r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
power.mod332(es=.2244, rho3=.1, rho2=.1, omegam3=.05,
q=.5, r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
mrss.mod332(es=.2244, rho3=.1, rho2=.1, omegam3=.05,
q=.5, r21=.30, r22=.4, r2m3=0, n=20, J=4)
# cross-checks for the randomly varying cont. L2 moderator effect
mdesd.mod332(rho3=.1, rho2=.1, omegam3=.05,
r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
power.mod332(es=.1209, rho3=.1, rho2=.1, omegam3=.05,
r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
mrss.mod332(es=.1209, rho3=.1, rho2=.1, omegam3=.05,
r21=.30, r22=.4, r2m3=0, n=20, J=4)
# cross-checks for the non-randomly varying bin. L2 moderator effect
mdesd.mod332(rho3=.1, rho2=.1, omegam3=0,
q=.5, r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
power.mod332(es=.2157, rho3=.1, rho2=.1, omegam3=0,
q=.5, r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
mrss.mod332(es=.2157, rho3=.1, rho2=.1, omegam3=0,
q=.5, r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
# cross-checks for the non-randomly varying cont. L2 moderator effect
mdesd.mod332(rho3=.1, rho2=.1, omegam3=0,
r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
power.mod332(es=.1079, rho3=.1, rho2=.1, omegam3=0,
r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
mrss.mod332(es=.1079, rho3=.1, rho2=.1, omegam3=0,
r21=.30, r22=.4, r2m3=0, n=20, J=4, K=60)
# cross-checks for the randomly varying bin. L3 moderator effect
mdesd.mod333(rho3=.1, rho2=.1, q=.5,
r21=.3, r22=.4, r23=.5, n=20, J=4, K=60)
power.mod333(es=.4128, rho3=.1, rho2=.1, q=.5,
r21=.3, r22=.4, r23=.5, n=20, J=4, K=60)
mrss.mod333(es=.4128, rho3=.1, rho2=.1, q=.5,
r21=.3, r22=.4, r23=.5, n=20, J=4, K=60)
# cross-checks for the randomly varying cont. L3 moderator effect
mdesd.mod333(rho3=.1, rho2=.1,
r21=.3, r22=.4, r23=.5, n=20, J=4, K=60)
power.mod333(es=.2064, rho3=.1, rho2=.1,
r21=.3, r22=.4, r23=.5, n=20, J=4, K=60)
mrss.mod333(es=.2064, rho3=.1, rho2=.1,
r21=.3, r22=.4, r23=.5, n=20, J=4, K=60)
# 3-3-1 mediation
power.med331(esa= .50, esB = .30, rho2 = .15, rho3 = .15,
r21 = .20, r22 = .20, g3 = 4,
n = 20, J = 4, K = 80, p = .5)
# 3-2-1 mediation
power.med321(esa= .51, esB = .30, rhom3 = 0.27, rho2 = .15, rho3 = .19,
r2m2 = .07, gm3 = 4, r2m3 = .16,
r21 = .02, r22 = .41, g3 = 5, r23 = .38,
p = .50, n = 20, J = 4, K = 60)
# 3-1-1 mediation
power.med311(esa= .49 , esB = .30,
rhom2 = .05, rhom3 = .26, rho2 = .15, rho3 = .20,
r2m1 = .10, r2m2 = .07, r2m3 = .17,
r21 = .02, r22 = .41, r23 = .38,
p = .50, n = 20, J = 4, K = 30)
# cross-checks for cluster-randomized block design
# treatment at level 3, with fixed effects across level 4 blocks
mdes.bcra4f3(rho3=.15, rho2=.15,
n=10, J=4, K=23, L=15)
power.bcra4f3(es=0.137, rho3=.15, rho2=.15,
n=10, J=4, K=33, L=15)
mrss.bcra4f3(es=0.137, rho3=.15, rho2=.15,
n=10, J=4, L=15)
# }
Run the code above in your browser using DataLab