| power.2m.mod | R Documentation |
This function can calculate power, required sample size/budget for desired power, or minimum detectable moderation effect size (MDMES) under a fixed budget in two-level MRTs. It also can perform conventional power analyses (e.g., required sample size, power, and MDMES calculation).
power.2m.mod(
cost.model = TRUE,
expr = NULL,
constraint = NULL,
sig.level = 0.05,
two.tailed = TRUE,
omega = NULL,
gamma = NULL,
power.mod = NULL,
m = NULL,
n = NULL,
J = NULL,
p = NULL,
icc = NULL,
r12 = NULL,
r22m = NULL,
q.mod = 1,
c1 = NULL,
c2 = NULL,
c1t = NULL,
gammalim = c(0, 5),
powerlim = c(1e-10, 1 - 1e-10),
Jlim = c(2.5, 1e+10),
mod.level = 1,
binary = TRUE,
mlim = NULL,
rounded = TRUE,
Q = 0.5
)
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. |
omega |
The treatment-by-site variance of the outcome. |
gamma |
The standardized moderated treatment effect. |
power.mod |
Statistical power for the moderation effect. The default is .80. |
m |
Total budget, default is the total costs of sampling 60 sites. |
n |
The level-1 sample size per level-2 unit. |
J |
The number of sites. |
p |
The proportion of level-1 units within each level 2 unit to be assigned to treatment. |
icc |
The unconditional intraclass correlation coefficient (ICC) in population or in each treatment condition. |
r12 |
The proportion of level-1 variance explained by covariates. |
r22m |
The proportion of variance of site-specific treatment effect explained by covariates. |
q.mod |
The number of predictors at the moderator level in the moderation model. |
c1 |
The cost of sampling one level-1 unit in control condition. |
c2 |
The cost of sampling one level-2 unit (site). |
c1t |
The cost of sampling one level-1 unit in treatment condition. |
gammalim |
The range for numerically solving the root of standardized moderation effect (gamma). Default is c(0, 5). |
powerlim |
The range for solving the root of power ( |
Jlim |
The range for solving the root of level-2 sample size
( |
mod.level |
The level of the moderator is at. The moderator is at level 1 if mod.level is 1, and at level 2 if mod.level is 2. The default is mod.level = 1. |
binary |
Logical; The moderator is binary if TRUE, and continuous if FALSE. The default is TRUE. |
mlim |
The range for numerically solving the root of budget ( |
rounded |
Logical; round the values of |
Q |
The proportion of units in one group for the binary moderator. Default is 0.5. |
power |
Statistical power.mod for a moderation effect. |
Required budget (and/or required level-2 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.
myod <- od.2m.mod(icc = .2, r12 = .5, r22m = .5,
c1 = 10, c1t = 100, c2 = 50,
omega = .01, gamma = 0.1)
mypower <- power.2m.mod(expr = myod, m=myod$out$m, gamma = 0.1); mypower$out
mym <- power.2m.mod(expr = myod, power.mod = .80, gamma = 0.1); mym$out
myod <- od.2m.only.mod(icc = .2, r12 = .5, r22m = .5,
c1 = 10, c1t = 100, c2 = 50, omega = .01)
mypower <- power.2m.mod(expr = myod, power.mod = .8, gamma = 0.1)
mypower$out
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.