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 inspect.score() function.

dists

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.

k1

left truncation point for (uncentered) empirical, truncated normal, or uniform distribution. Ignored when rhots = 0 or order = 0.

k2

right truncation point for (uncentered) empirical, truncated normal, or uniform distribution. Ignored when rhots = 0 or order = 0.

order

integer >= 0; order of polynomial functional form specification for the score variable.

interaction

logical; if TRUE polynomial specification interacts with the treatment variable.

rhots

obsolote; use order = 0 to obtain results equivalent to random assignment designs.

treat.lower

logical; if TRUE units below cutoff the are treated.

cutoff

decision threshold.

p

proportion of units in the treatment condition.

power

statistical power (1 - \beta).

es

numeric > 0; effect size (Cohen's d).

alpha

probability of type I error (\alpha).

two.tailed

logical; TRUE for two-tailed hypothesis testing.

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. c(10, 5).

cn2

marginal cost per stratum or fixed block.

cost

total cost or budget. Ignored when constrain = "power" or constrain = "es".

constrain

character; constrains one of the "cost", "power", or "es" at the specified value.

n0

starting value for n1 or n1, n2. Starting value is replaced with the average when sample size is constrained by bounds.

p0

starting value for p when rhots = 0 and p = NULL. Starting value is replaced with average when p is constrained by bounds.

round

logical; TRUE for rounded BCOSSA solution.

max.power

logical; TRUE for maximizing power instead of minimizing variance, applies when constrain = "cost"

local.solver

subset of c("LBFGS", "SLSQP")

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 - \alpha)% confidence limits.

power

statistical power (1 - \beta)

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)

[Package cosa version 2.1.0 Index]