| od.2m.mod | R Documentation |
The optimal design of two-level
MRTs probing main and moderation effects
identify the optimal sample allocations.
The optimal design parameters include
the level-1 sample size per level-2 unit (n)
and the proportion of level-1 individuals/units assigned to
the experimental group (p).
This function solves the optimal n and/or p
with and without a constraint.
od.2m.mod(
n = NULL,
p = NULL,
icc = NULL,
r12 = NULL,
r22m = NULL,
c1 = NULL,
c2 = NULL,
c1t = NULL,
omega = NULL,
m = NULL,
plots = TRUE,
plot.by = list(n = "n", p = "p"),
verbose = TRUE,
iter = 100,
tol = 1e-10,
q = 1,
q.mod = 1,
d = 0.1,
gamma = 0.1,
power = 0.8,
power.mod = 0.8,
mod.level = 1,
d.p = c(0.1, 0.5),
d.n = c(2, 1000),
sig.level = 0.05,
two.tailed = TRUE,
Jlim = c(2.5, 1e+10),
binary = TRUE,
nrange = c(2, 10000),
Q = 0.5,
max.value = Inf,
max.iter = 300,
e = 1e-10,
n.of.ants = 10,
n.of.archive = 50,
q.aco = 1e-04,
xi = 0.5
)
n |
The level-1 sample size per level-2 unit. |
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. |
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. |
omega |
The treatment-by-site variance of the outcome. |
m |
Total budget, default is the total costs of sampling 60 sites. |
plots |
Logical, provide variance plots if TRUE, otherwise not; default value is TRUE. |
plot.by |
Plot the variance by |
verbose |
Logical; print the values of |
iter |
Number of iterations; default value is 100. |
tol |
Tolerance for convergence; default value is 1e-10. |
q |
The number of covariates in the model detecting the main/average treatment effect. The default is 1. |
q.mod |
The number of predictors at the moderator level in the moderation model. |
d |
Standardized effect size, default is 0.1. |
gamma |
The standardized moderated treatment effect. |
power |
Statistical power specified for the main effect. The default is .80. |
power.mod |
Statistical power for the moderation effect. The default is .80. |
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. |
d.p |
The initial sampling domains for p. Default is c(0.1, 0.5). |
d.n |
The initial sampling domain for n. Default is c(2, 1000). |
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. |
Jlim |
The range for solving the root of level-2 sample size
( |
binary |
Logical; The moderator is binary if TRUE, and continuous if FALSE. The default is TRUE. |
nrange |
The range of the level-1 sample size per level-2 unit that used to exclude unreasonable values. Default value is c(2, 10000). |
Q |
The proportion of units in one group for the binary moderator. Default is 0.5. |
max.value |
Maximal value of optimization when used as the stopping criterion. Default is -Inf. |
max.iter |
Maximal number of function evaluations when used as the stopping criterion. |
e |
Maximum error value used when solution quality used as the stopping criterion, default is 1e-10. |
n.of.ants |
Number of ants used in each iteration after the initialization of power analysis for calculating required budget, default value is 10. |
n.of.archive |
Size of the solution archive, default is 100. |
q.aco |
The locality of the search (0, 1) |
xi |
Convergence pressure (0, Inf), suggested: (0, 1), default is 0.5. |
Unconstrained or constrained optimal sample allocation (n and p).
The function also returns statistical power formulas,
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)
myod$out
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.