Use mdes.crd3r3()
to calculate minimum detectable effect size, power.crd3r3()
to calculate statistical power, and cosa.crd3r3()
for constrained optimal sample allocation.
If higher level strata or fixed blocks exist, use mdes.bcrd4f3()
to calculate minimum detectable effect size, power.bcrd4f3()
to calculate statistical power, and cosa.bcrd4f3()
for constrained optimal sample allocation.
cosa.crd3r3(cn1 = 0, cn2 = 0, cn3 = 0, cost = NULL,
n1 = NULL, n2 = NULL, n3 = NULL, p = NULL,
n0 = c(10, 3, 100 + g3), p0 = .499, constrain = "power",
round = TRUE, max.power = FALSE,
local.solver = c("LBFGS", "SLSQP", "MMA", "COBYLA"),
rhots = NULL, k1 = -6, k2 = 6, dists = "normal",
power = .80, es = .25, alpha = .05, two.tailed = TRUE,
rho2, rho3, g3 = 0, r21 = 0, r22 = 0, r23 = 0)cosa.bcrd4f3(cn1 = 0, cn2 = 0, cn3 = 0, cn4 = 0, cost = NULL,
n1 = NULL, n2 = NULL, n3 = NULL, n4 = NULL, p = NULL,
n0 = c(10, 3, 100 + g3, 5), p0 = .499, constrain = "power",
round = TRUE, max.power = FALSE,
local.solver = c("LBFGS", "SLSQP", "MMA", "COBYLA"),
rhots = NULL, k1 = -6, k2 = 6, dists = "normal",
power = .80, es = .25, alpha = .05, two.tailed = TRUE,
rho2, rho3, g3 = 0, r21 = 0, r22 = 0, r23 = 0)
mdes.crd3r3(power = .80, alpha = .05, two.tailed = TRUE,
rhots = NULL, k1 = -6, k2 = 6, dists = "normal",
rho2, rho3, r21 = 0, r22 = 0, r23 = 0, g3 = 0,
p = .50, n1, n2, n3)
mdes.bcrd4f3(power = .80, alpha = .05, two.tailed = TRUE,
rhots = NULL, k1 = -6, k2 = 6, dists = "normal",
rho2, rho3, r21 = 0, r22 = 0, r23 = 0, g3 = 0,
p = .50, n1, n2, n3, n4)
power.crd3r3(es = .25, alpha = .05, two.tailed = TRUE,
rhots = NULL, k1 = -6, k2 = 6, dists = "normal",
rho2, rho3, r21 = 0, r22 = 0, r23 = 0, g3 = 0,
p = .50, n1, n2, n3)
power.bcrd4f3(es = .25, alpha = .05, two.tailed = TRUE,
rhots = NULL, k1 = -6, k2 = 6, dists = "normal",
rho2, rho3, r21 = 0, r22 = 0, r23 = 0, g3 = 0,
p = .50, n1, n2, n3, n4)
marginal cost per level 1 unit in treatment and control conditions.
marginal cost per level 2 unit in treatment and control conditions.
marginal cost per level 3 unit in treatment and control conditions.
marginal cost per stratum or fixed block.
total cost or budget.
average number of level 1 units per level 2 unit.
average number of level 2 units per level 3 unit.
number of level 3 units(per stratum or block, if exists).
number of stratum or fixed blocks.
proportion of level 3 units in treatment condition.
vector of starting values for n1, n2, n3
or n1, n2, n3, n4
(positional). Starting values are replaced with averages when sample sizes are constrained by bounds.
starting value for p
when rhots = 0
and p = NULL
. Starting value is replaced with average when p
is constrained by bounds.
statistical power (1 - \(\beta\)).
effect size (Cohen's d).
probability of type I error (\(\alpha\)).
logical; TRUE
for two-tailed hypothesis testing.
character; "cost"
, "power"
, or "mdes"
.
logical; TRUE
for rounded COSA solution.
logical; TRUE
for maximizing power instead of minimizing variance.
subset of c("LBFGS", "SLSQP", "MMA", "COBYLA")
correlation between the treatment and the scoring variable. Specify rhots = 0
to obtain results equivalent to random assignment designs.
left truncation point (in standard deviation units from full normal distribution mean), ignored when rhots
is not NULL
or dists = "uniform"
.
right truncation point (in standard deviation units from full normal distribution mean), ignored when rhots
is not NULL
or dists = "uniform"
.
distribution of the scoring variable; "normal"
or "uniform"
. By default, dists = "normal"
specification implies a truncated normal distribution with k1 = -6
and k2 = 6
.
proportion of variance in the outcome between level 2 units (unconditional ICC2).
proportion of variance in the outcome between level 3 units (unconditional ICC3).
number of covariates at level 3.
proportion of level 1 variance in the outcome explained by level 1 covariates.
proportion of level 2 variance in the outcome explained by level 2 covariates.
proportion of level 3 variance in the outcome explained by level 3 covariates.
list of parameters used in the function.
degrees of freedom.
standardized standard error.
constrained optimal sample allocation.
minimum detectable effect size and (1 - \(\alpha\))% confidence limits.
statistical power (1 - \(\beta\))
# NOT RUN {
# cost constrained - optimize n2 and n3
cosa.crd3r3(constrain = "cost", cost = 100000,
cn1 = 5, cn2 = c(10, 5), cn3 = c(30, 10),
es = .20, rho2 = .20, rho3 = .10,
r21 = .20, r22 = .30, r23 = .40,
g3 = 1, p = .50, n1 = 25, n2 = NULL, n3 = NULL)
# minimum detectable effect size
mdes.crd3r3(power = .80, rho2 = .20, rho3 = .10,
r21 = .20, r22 = .30, r23 = .40,
g3 = 1, p = .50, n1 = 19.39, n2 = 3, n3 = 300)
# statistical power
power.crd3r3(es = .20, rho2 = .20, rho3 = .10,
r21 = .20, r22 = .30, r23 = .40,
g3 = 1, p = .50, n1 = 19.39, n2 = 3, n3 = 300)
# }
Run the code above in your browser using DataLab