Skip to contents

Thin extender over rdpower::rdpower for sharp / fuzzy RDD power analysis (Cattaneo, Titiunik & Vazquez-Bare, 2019).

Usage

morie_rdd_power_calc(data, cutoff = 0, ...)

Arguments

data

Numeric matrix or data frame with two columns: the outcome \(Y\) and the running variable \(R\) (as expected by rdpower::rdpower's data argument).

cutoff

Numeric scalar; the cutoff for the running variable (default 0).

...

Further arguments forwarded to rdpower::rdpower (e.g. tau, nsamples, kernel, vce, alpha, rho).

Value

A list with $method = "rdpower::rdpower" and $raw (an rdpower object with the simulated power and effective sample sizes).

Details

Named morie_rdd_power_calc rather than morie_rdd_power because the latter is already taken in R/rdd.R by a closed-form analytical power formula that takes scalar (n, tau, sigma) rather than a data frame; this wrapper preserves that function and offers the full rdpower simulation-based surface alongside it.

Examples

if (FALSE) { # \dontrun{
  if (requireNamespace("rdpower", quietly = TRUE)) {
    set.seed(1)
    R <- runif(500, -1, 1)
    Y <- 0.4 * R + (R >= 0) * 0.2 + rnorm(500, sd = 0.5)
    morie_rdd_power_calc(cbind(Y, R), cutoff = 0, tau = 0.2)
  }
} # }