Learn R Programming

cosa (version 1.2.0)

ird1r1: Simple Individual-level Regression Discontinuity (w/ or w/o Strata or Fixed Blocks)

Description

Use mdes.ird1r1() to calculate minimum detectable effect size, power.ird1r1() to calculate statistical power, and cosa.ird1r1() for constrained optimal sample allocation.

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 constrained optimal sample allocation.

Usage

cosa.ird1r1(cn1 = 0,  cost = NULL, n1 = NULL, p = NULL,
            n0 = c(400 + g1), 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,
            g1 = 0, r21 = 0)

cosa.bird2f1(cn1 = 0, cn2 = 0, cost = NULL, n1 = NULL, n2 = NULL, p = NULL, n0 = c(400 + g1, 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, g1 = 0, r21 = 0)

mdes.ird1r1(power = .80, alpha = .05, two.tailed = TRUE, rhots = NULL, k1 = -6, k2 = 6, dists = "normal", r21 = 0, g1 = 0, p = .50, n1)

mdes.bird2f1(power = .80, alpha = .05, two.tailed = TRUE, rhots = NULL, k1 = -6, k2 = 6, dists = "normal", r21 = 0, g1 = 0, p = .50, n1, n2)

power.ird1r1(es = .25, alpha = .05, two.tailed = TRUE, rhots = NULL, k1 = -6, k2 = 6, dists = "normal", r21 = 0, g1 = 0, p = .50, n1)

power.bird2f1(es = .25, alpha = .05, two.tailed = TRUE, rhots = NULL, k1 = -6, k2 = 6, dists = "normal", r21 = 0, g1 = 0, p = .50, n1, n2)

Arguments

cn1

marginal cost per unit in treatment and control conditions.

cn2

marginal cost per stratum or fixed block.

cost

total cost or budget.

n1

sample size (per stratum or block, if exists).

n2

number of stratum or fixed blocks.

p

proportion of units in treatment condition.

n0

starting value for n1 or n1, n2. Starting value is replaced with 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.

power

statistical power (1 - \(\beta\)).

es

effect size (Cohen's d).

alpha

probability of type I error (\(\alpha\)).

two.tailed

logical; TRUE for two-tailed hypothesis testing.

constrain

character; "cost", "power", or "mdes".

round

logical; TRUE for rounded COSA solution.

max.power

logical; TRUE for maximizing power instead of minimizing variance.

local.solver

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

rhots

correlation between the treatment and the scoring variable. Specify rhots = 0 to obtain results equivalent to random assignment designs.

k1

left truncation point (in standard deviation units from full normal distribution mean), ignored when rhots is not NULL or dists = "uniform".

k2

right truncation point (in standard deviation units from full normal distribution mean), ignored when rhots is not NULL or dists = "uniform".

dists

character; distribution of the scoring variable, "normal" or "uniform". By default, dists = "normal" specification implies a truncated normal distribution with k1 = -6 and k2 = 6.

g1

number of covariates.

r21

proportion of variance in the outcome explained by covariates.

Value

parms

list of parameters used in the function.

df

degrees of freedom.

sse

standardized standard error.

cosa

constrained optimal sample allocation.

mdes

minimum detectable effect size and (1 - \(\alpha\))% confidence limits.

power

statistical power (1 - \(\beta\))

Examples

Run this code
# NOT RUN {
# cost constrained - optimize p and n1
cosa.ird1r1(rhots = 0,  constrain = "cost", cost = 1000,
            cn1 = c(10,5), p = NULL, n1 = NULL)

# minimum detectable effect size
mdes.ird1r1(power = .80, r2 = .20, g = 1, p = .50, n = 500)

# statistical power
power.ird1r1(es = .373, r2 = .20, g = 1, p = .50, n = 500)
# }

Run the code above in your browser using DataLab