power.3 {odr} | R Documentation |
Budget and/or sample size, power, MDES calculation for three-level CRTs detecting main effects
Description
This function can calculate required budget for desired power, power or minimum detectable effect size (MDES) under fixed budget for three-level cluster randomized trials (CRTs). It also can perform conventional power analyses (e.g., required sample size, power, and MDES calculation).
Usage
power.3(
cost.model = TRUE,
expr = NULL,
constraint = NULL,
sig.level = 0.05,
two.tailed = TRUE,
d = NULL,
power = NULL,
m = NULL,
n = NULL,
J = NULL,
K = NULL,
p = NULL,
icc2 = NULL,
icc3 = NULL,
r12 = NULL,
r22 = NULL,
r32 = NULL,
q = NULL,
c1 = NULL,
c2 = NULL,
c3 = NULL,
c1t = NULL,
c2t = NULL,
c3t = NULL,
dlim = NULL,
powerlim = NULL,
Klim = NULL,
mlim = NULL,
rounded = TRUE
)
Arguments
cost.model |
Logical; power analyses accommodating costs and budget (e.g., required budget for desired power, power/MDES under fixed budget) if TRUE, otherwise conventional power analyses (e.g., required sample size, power, or MDES calculation); default value is TRUE. |
expr |
Returned objects from function |
constraint |
Specify the constrained values of |
sig.level |
Significance level or type I error rate, default value is 0.05. |
two.tailed |
Logical; two-tailed tests if TRUE, otherwise one-tailed tests; default value is TRUE. |
d |
Effect size. |
power |
Statistical power. |
m |
Total budget. |
n |
The level-1 sample size per level-2 unit. |
J |
The level-2 sample size per level-3 unit. |
K |
The total level-3 sample size. |
p |
The proportion of level-3 clusters/units assigned to treatment. |
icc2 |
The unconditional intraclass correlation coefficient (ICC) at level 2. |
icc3 |
The unconditional intraclass correlation coefficient (ICC) at level 3. |
r12 |
The proportion of level-1 variance explained by covariates. |
r22 |
The proportion of level-2 variance explained by covariates. |
r32 |
The proportion of level-3 variance explained by covariates. |
q |
The number of covariates at level 3. |
c1 |
The cost of sampling one level-1 unit in control condition. |
c2 |
The cost of sampling one level-2 unit in control condition. |
c3 |
The cost of sampling one level-3 unit in control condition. |
c1t |
The cost of sampling one level-1 unit in treatment condition. |
c2t |
The cost of sampling one level-2 unit in treatment condition. |
c3t |
The cost of sampling one level-3 unit in treatment condition. |
dlim |
The range for solving the root of effect size ( |
powerlim |
The range for solving the root of power ( |
Klim |
The range for searching the root of level-3 sample size ( |
mlim |
The range for searching the root of budget ( |
rounded |
Logical; round the values of |
Value
Required budget (and/or required level-3 sample size), statistical power, or MDES depending on the specification of parameters. The function also returns the function name, design type, and parameters used in the calculation.
References
Shen, Z., & Kelcey, B. (2020). Optimal sample allocation under unequal costs in cluster-randomized trials. Journal of Educational and Behavioral Statistics, 45(4): 446–474. <https://doi.org/10.3102/1076998620912418>
Examples
# Unconstrained optimal design
myod1 <- od.3(icc2 = 0.2, icc3 = 0.1, r12 = 0.5, r22 = 0.5, r32 = 0.5,
c1 = 1, c2 = 5, c3 = 25, c1t = 1, c2t = 50, c3t = 250)
myod1$out # output # n = 7.9, J = 3.2, p = 0.28
# ------- Power analyses by default considering costs and budget -------
# Required budget and sample size
mym.1 <- power.3(expr = myod1, d = 0.2, q = 1, power = 0.8)
mym.1$out # m = 16032, K = 97.3
#mym.1$par # parameters and their values used for the function
# Or, equivalently, specify every argument in the function
mym.1 <- power.3(d = 0.2, power = 0.8, q = 1,
icc2 = 0.2, icc3 = 0.1, r12 = 0.5, r22 = 0.5, r32 = 0.5,
c1 = 1, c2 = 5, c3 = 25, c1t = 1, c2t = 50, c3t = 250,
n = 8, J = 3, p = 0.28)
# Required budget and sample size with constrained p
mym.2 <- power.3(expr = myod1, d = 0.2, q = 1, power = 0.8,
constraint = list(p = 0.5))
mym.2$out # m = 19239, K = 78.8
# Required budget and sample size with constrained p and J
mym.3 <- power.3(expr = myod1, d = 0.2, q = 1, power = 0.8,
constraint = list(p = 0.5, J = 20))
mym.3$out # m = 39774, K = 46.9
# Power calculation
mypower <- power.3(expr = myod1, q = 1, d = 0.2, m = 16032)
mypower$out # power = 0.80
# Power calculation under constrained p (p = 0.5)
mypower.1 <- power.3(expr = myod1, q = 1, d = 0.2, m = 16032,
constraint = list(p = 0.5))
mypower.1$out # power = 0.72
# MDES calculation
mymdes <- power.3(expr = myod1, q = 1, power = 0.80, m = 16032)
mymdes$out # d = 0.20
# ------- Conventional power analyses with cost.model = FALSE-------
# Required sample size
myK <- power.3(cost.model = FALSE, expr = myod1, d = 0.2, q = 1, power = 0.8)
myK$out # K = 97.3
#myK$par # parameters and their values used for the function
# Or, equivalently, specify every argument in the function
myK <- power.3(cost.model = FALSE, d = 0.2, power = 0.8, q = 1,
icc2 = 0.2, icc3 = 0.1, r12 = 0.5, r22 = 0.5, r32 = 0.5,
n = 8, J = 3, p = 0.28)
# Power calculation
mypower1 <- power.3(cost.model = FALSE, expr = myod1, K = 97, d = 0.2, q = 1)
mypower1$out # power = 0.80
# MDES calculation
mymdes1 <- power.3(cost.model = FALSE, expr = myod1, K = 97, power = 0.8, q = 1)
mymdes1$out # d = 0.20