ird {cosa} | R Documentation |
Simple Individual-level Regression Discontinuity (w/ or w/o Strata or Fixed Blocks)
Description
Use mdes.ird()
to calculate minimum detectable effect size and power.ird()
to calculate statistical power. If higher level strata or fixed blocks exist, use mdes.bird2f1()
to calculate minimum detectable effect size, power.bird2f1()
to calculate statistical power, and cosa.bird2f1()
for bound constrained optimal sample size allocation (BCOSSA).
Usage
mdes.ird(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 = n1 - g1 - order * (1 + interaction) - 2,
r21 = 0, g1 = 0, rate.tp = 1, rate.cc = 0, n1)
power.ird(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 = n1 - g1 - order * (1 + interaction) - 2,
r21 = 0, g1 = 0, rate.tp = 1, rate.cc = 0, n1)
mdes.bird2f1(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 * (n1 - 2) - g1 - order * (1 + interaction),
r21 = 0, g1 = 0, rate.tp = 1, rate.cc = 0, n1, n2 = 1)
power.bird2f1(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 * (n1 - 2) - g1 - order * (1 + interaction),
r21 = 0, g1 = 0, rate.tp = 1, rate.cc = 0, n1, n2 = 1)
cosa.bird2f1(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(400, 5), p0 = .499,
constrain = "power", round = TRUE, max.power = FALSE,
local.solver = c("LBFGS", "SLSQP"),
power = .80, es = .25, alpha = .05, two.tailed = TRUE,
g1 = 0, r21 = 0)
Arguments
score |
vector or list; an empirical score variable or an object with class 'score' returned from the |
dists |
character; distribution of the score variable, |
k1 |
left truncation point for (uncentered) empirical, truncated normal, or uniform distribution. Ignored when |
k2 |
right truncation point for (uncentered) empirical, truncated normal, or uniform distribution. Ignored when |
order |
integer >= 0; order of polynomial functional form specification for the score variable. |
interaction |
logical; if |
rhots |
obsolote; use |
treat.lower |
logical; if |
cutoff |
decision threshold. |
p |
proportion of units in the treatment condition. |
power |
statistical power (1 - |
es |
numeric > 0; effect size (Cohen's d). |
alpha |
probability of type I error ( |
two.tailed |
logical; |
df |
degrees of freedom. |
g1 |
number of covariates. |
r21 |
proportion of variance in the outcome explained by covariates. |
rate.tp |
treatment group participation rate. |
rate.cc |
control group crossover rate. |
n1 |
sample size (per stratum or block, if exists). |
n2 |
number of stratum or fixed blocks. |
cn1 |
marginal cost per unit in treatment and control conditions, e.g. |
cn2 |
marginal cost per stratum or fixed block. |
cost |
total cost or budget. Ignored when |
constrain |
character; constrains one of the |
n0 |
starting value for |
p0 |
starting value for |
round |
logical; |
max.power |
logical; |
local.solver |
subset of |
Value
parms |
list of parameters used in the function. |
df |
degrees of freedom. |
sse |
standardized standard error. |
cosa |
BCOSSA solution. |
mdes |
minimum detectable effect size and (1 - |
power |
statistical power (1 - |
Examples
score.obj <- inspect.score(rnorm(1000),
order = 1, interaction = FALSE,
cutoff = 0, k1 = -1, k2 = 1)
# single site (no blocks)
power.ird(score.obj, g1 = 0, r21 = 0,
es = 0.25, n = 100)
# with 5 blocks (note that r21 is modified but g1 remains the same)
power.bird2f1(score.obj, g1 = 0, r21 = .30,
es = 0.25, n1 = 100, n2 = 5)
# minimum required sample size for each block
cosa.bird2f1(score.obj, g1 = 0, r21 = .30,
n1 = NULL, n2 = 5)