Use mdes.crd2()
to calculate minimum detectable effect size, power.crd2()
to calculate statistical power, and cosa.crd2()
for bound constrained optimal sample size allocation (BCOSSA). If higher level strata or fixed blocks exist, use mdes.bcrd3f2()
to calculate minimum detectable effect size, power.bcrd3f2()
to calculate statistical power, and cosa.bcrd3f2()
for BCOSSA.
mdes.crd2(score = NULL, dists = "normal", k1 = -6, k2 = 6,
order = 1, interaction = FALSE,
treat.lower = TRUE, cutoff = 0, p = NULL,
power = .80, alpha = .05, two.tailed = TRUE,
df = n2 - g2 - order * (1 + interaction) - 2,
rho2, r21 = 0, r22 = 0, g2 = 0, rate.tp = 1, rate.cc = 0, n1, n2)power.crd2(score = NULL, dists = "normal", k1 = -6, k2 = 6,
order = 1, interaction = FALSE,
treat.lower = TRUE, cutoff = 0, p = NULL,
es = .25, alpha = .05, two.tailed = TRUE,
df = n2 - g2 - order * (1 + interaction) - 2,
rho2, r21 = 0, r22 = 0, g2 = 0, rate.tp = 1, rate.cc = 0, n1, n2)
cosa.crd2(score = NULL, dists = "normal", k1 = -6, k2 = 6, rhots = NULL,
order = 1, interaction = FALSE,
treat.lower = TRUE, cutoff = 0, p = NULL,
cn1 = 0, cn2 = 0, cost = NULL,
n1 = NULL, n2 = NULL, n0 = c(10, 100), p0 = .499,
constrain = "power", round = TRUE,
max.power = FALSE, local.solver = c("LBFGS", "SLSQP"),
power = .80, es = .25, alpha = .05, two.tailed = TRUE,
rho2, g2 = 0, r21 = 0, r22 = 0)
mdes.bcrd3f2(score = NULL, dists = "normal", k1 = -6, k2 = 6,
order = 1, interaction = FALSE,
treat.lower = TRUE, cutoff = 0, p = NULL,
power = .80, alpha = .05, two.tailed = TRUE,
df = n3 * (n2 - 2) - g2 - order * (1 + interaction),
rho2, r21 = 0, r22 = 0, g2 = 0,
rate.tp = 1, rate.cc = 0, n1, n2, n3)
power.bcrd3f2(score = NULL, dists = "normal", k1 = -6, k2 = 6,
order = 1, interaction = FALSE,
treat.lower = TRUE, cutoff = 0, p = NULL,
es = .25, alpha = .05, two.tailed = TRUE,
df = n3 * (n2 - 2) - g2 - order * (1 + interaction),
rho2, r21 = 0, r22 = 0, g2 = 0,
rate.tp = 1, rate.cc = 0, n1, n2, n3)
cosa.bcrd3f2(score = NULL, dists = "normal", k1 = -6, k2 = 6, rhots = NULL,
order = 1, interaction = FALSE,
treat.lower = TRUE, cutoff = 0, p = NULL,
cn1 = 0, cn2 = 0, cn3 = 0, cost = NULL,
n1 = NULL, n2 = NULL, n3 = NULL,
n0 = c(10, 100, 5), p0 = .499,
constrain = "power", round = TRUE, max.power = FALSE,
local.solver = c("LBFGS", "SLSQP"),
power = .80, es = .25, alpha = .05, two.tailed = TRUE,
rho2, g2 = 0, r21 = 0, r22 = 0)
vector or list; an empirical score variable or an object with class 'score' returned from the inspect.score()
function.
character; distribution of the score variable, "normal"
or "uniform"
. By default, dists = "normal"
specification implies a truncated normal distribution with k1 = -6
and k2 = 6
.
left truncation point for (uncentered) empirical, truncated normal, or uniform distribution. Ignored when rhots = 0
or order = 0
.
right truncation point for (uncentered) empirical, truncated normal, or uniform distribution. Ignored when rhots = 0
or order = 0
.
integer >= 0; order of polynomial functional form specification for the score variable.
logical; if TRUE
polynomial specification interacts with the treatment variable.
obsolote; use order = 0
to obtain results equivalent to random assignment designs.
logical; if TRUE
units below the cutoff are treated.
decision threshold.
proportion of level 2 units in the treatment condition.
statistical power (1 - \(\beta\)).
effect size (Cohen's d).
probability of type I error (\(\alpha\)).
logical; TRUE
for two-tailed hypothesis testing.
degrees of freedom.
proportion of variance in the outcome between level 2 units (unconditional ICC2).
number of covariates at level 2.
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.
treatment group participation rate.
control group crossover rate.
average number of level 1 units per level 2 unit.
number of level 2 units (per stratum or block, if exists).
number of stratum or fixed blocks.
marginal costs per level 1 unit in treatment and control conditions (positional), e.g. c(10, 5)
.
marginal costs per level 2 unit in treatment and control conditions (positional), e.g. c(50, 30)
.
marginal cost per stratum or fixed block.
total cost or budget. Ignored when constrain = "power"
or constrain = "es"
.
vector of starting values for n1, n2
or n1, n2, n3
(positional). Starting values are replaced with the averages when sample sizes are constrained by bounds.
starting value for p
when rhots = 0
or order = 0
, and p = NULL
. Starting value is replaced with the average when p
is constrained by bounds.
character; constrains one of the "cost"
, "power"
, or "es"
at the specified value.
logical; TRUE
for rounded BCOSSA solution.
logical; TRUE
for maximizing the power rate instead of minimizing the variance. Applies when constrain = "cost"
.
subset of c("LBFGS", "SLSQP")
list of parameters used in the function.
degrees of freedom.
standardized standard error.
BCOSSA solution.
minimum detectable effect size and (1 - \(\alpha\))% confidence limits.
statistical power (1 - \(\beta\))
# NOT RUN {
score.obj <- inspect.score(rnorm(1000),
order = 1, interaction = FALSE,
cutoff = 0, k1 = -1, k2 = 1)
# single site (no blocks)
power.crd2(score.obj,
es = .25, rho2 = .20, g2 = 0, r22 = 0,
n1 = 50, n2 = 30)
# with 5 blocks (note that r22 is modified but g2 remains the same)
power.bcrd3f2(score.obj,
es = .25, rho2 = .20, g2 = 0, r22 = .30,
n1 = 50, n2 = 30, n3 = 5)
# minimum required number of level 2 units for each block
cosa.bcrd3f2(score.obj,
es = .25, rho2 = .20, g2 = 0, r22 = .30,
n1 = 50, n2 = NULL, n3 = 5)
# }
Run the code above in your browser using DataLab