Learn R Programming

PowerUpR (version 1.0.1)

cra3r3: Three-level Cluster-randomized Trials to Detect Main and Moderation Effects

Description

Use mdes.<design>() to calculate minimum detectable effect size for main effect, mdesd.<design>() to calculate minimum detectable effect size difference for moderation effect, power.<design>() to calculate statistical power, and mrss.<design>() to calculate minimum required sample size. Use <output>.cra3r3() for main effect, <output>.mod331() for moderator effect at level 1, <output>.mod332() for moderator effect at level 2, <output>.mod333() for moderator effect at level 3.

Usage

mdes.cra3r3(power=.80, alpha=.05, two.tailed=TRUE,
            rho2, rho3, p=.50, g3=0, r21=0, r22=0, r23=0,
            n, J, K)

mdesd.mod331(power=.80, alpha=.05, two.tailed=TRUE, rho2, rho3, omegam2=0, omegam3=0, g1=0, r21=0, r2m2=0, r2m3=0, p=.50, q=NULL, n, J, K)

mdesd.mod332(power=.80, alpha=.05, two.tailed=TRUE, rho2, rho3, omegam3, g2=0, r21=0, r22=0, r2m3=0, p=.50, q=NULL, n, J, K)

mdesd.mod333(power=.80, alpha=.05, two.tailed=TRUE, rho2, rho3, g3=0, r21=0, r22=0, r23=0, p=.50, q=NULL, n, J, K)

power.cra3r3(es=.25, alpha=.05, two.tailed=TRUE, rho2, rho3, g3=0, r21=0, r22=0, r23=0, p=.50, q=NULL, n, J, K)

power.mod331(es=.25, alpha=.05, two.tailed=TRUE, rho2, rho3, omegam2, omegam3, g1=0, r21=0, r2m2=0, r2m3=0, p=.50, q=NULL, n, J, K)

power.mod332(es=.25, alpha=.05, two.tailed=TRUE, rho2, rho3, omegam3, g2=0, r21=0, r22=0, r2m3=0, p=.50, q=NULL, n, J, K)

power.mod333(es=.25, alpha=.05, two.tailed=TRUE, rho2, rho3, g3=0, r21=0, r22=0, r23=0, p=.50, q=NULL, n, J, K)

mrss.cra3r3(es=.25, power=.80, alpha=.05, two.tailed=TRUE, n, J, K0=10, tol=.10, rho2, rho3, p=.50, g3=0, r21=0, r22=0, r23=0)

mrss.mod331(es=.25, power=.80, alpha=.05, two.tailed=TRUE, rho2, rho3, omegam2, omegam3, g1=0, r21=0, r2m2=0, r2m3=0, p=.50, q=NULL, n, J, K0=10, tol=.10)

mrss.mod332(es=.25, power=.80, alpha=.05, two.tailed=TRUE, rho2, rho3, omegam3, g2=0, r21=0, r22=0, r2m3=0, p=.50, q=NULL, n, J, K0=10, tol=.10)

mrss.mod333(es=.25, power=.80, alpha=.05, two.tailed=TRUE, rho2, rho3, g3=0, r21=0, r22=0, r23=0, p=.50, q=NULL, n, J, K0=10, tol=.10)

Arguments

power

statistical power \((1-\beta)\).

es

effect size.

alpha

probability of type I error.

two.tailed

logical; TRUE for two-tailed hypothesis testing, FALSE for one-tailed hypothesis testing.

rho2

proportion of variance in the outcome between level 2 units (unconditional ICC2).

rho3

proportion of variance in the outcome between level 3 units (unconditional ICC3).

omegam2

ratio of the unconditional variance in the moderator effect that is between level 2 units to the residual variance between level 2 units in the null model.

omegam3

ratio of the unconditional variance in the moderator effect that is between level 3 units to the residual variance between level 3 units in the null model.

p

proportion of level 3 units randomly assigned to treatment.

q

proportion of level 1, level 2, or level 3 units in the moderator subgroup.

g1

number of covariates at level 1.

g2

number of covariates at level 2.

g3

number of covariates at level 3.

r21

proportion of level 1 variance in the outcome explained by level 1 covariates.

r22

proportion of level 2 variance in the outcome explained by level 2 covariates.

r23

proportion of level 3 variance in the outcome explained by level 3 covariates.

r2m2

proportion of variance in the moderator effect that is explained by level 2 covariates.

r2m3

proportion of variance in the moderator effect that is explained by level 3 covariates.

n

harmonic mean of level 1 units across level 2 units (or simple average).

J

harmonic mean of level 2 units across level 3 units (or simple average).

K

level 3 sample size.

K0

starting value for K.

tol

tolerance to end iterative process for finding K.

Value

fun

function name.

parms

list of parameters used in power calculation.

df

degrees of freedom.

ncp

noncentrality parameter.

power

statistical power \((1-\beta)\).

mdes

minimum detectable effect size.

K

number of level 3 units.

See Also

For a more flexible sample size determination see cosa.crd3r3.

Examples

Run this code
# NOT RUN {
# cross-checks for the main effect
mdes.cra3r3(rho3=.06, rho2=.17, n=15, J=3, K=60)
power.cra3r3(es=.269, rho3=.06, rho2=.17, n=15, J=3, K=60)
mrss.cra3r3(es=.269, rho3=.06, rho2=.17, n=15, J=3)

# cross-checks for the randomly varying cont. L1 moderator effect
mdes.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)
# }

Run the code above in your browser using DataLab