Thin extender over rdpower::rdpower for sharp / fuzzy RDD
power analysis (Cattaneo, Titiunik & Vazquez-Bare, 2019).
Arguments
- data
Numeric matrix or data frame with two columns: the outcome \(Y\) and the running variable \(R\) (as expected by
rdpower::rdpower'sdataargument).- 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
# \donttest{
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)
}
#> $method
#> [1] "rdpower::rdpower"
#>
#> $raw
#>
#> Number of obs = 500
#> BW type = mserd
#> Kernel type = Triangular
#> VCE method = NN
#> Derivative = 0
#> HA: tau = 0.2
#>
#>
#> Cutoff c = 0 Left of c Right of c
#> Number of obs 270 230
#> Eff. number of obs 80 50
#> BW loc. poly. 0.245 0.245
#> Order loc. poly. 1 1
#> Sampling BW 0.245 0.245
#> New sample 80 50
#>
#>
#> =========================================================================================
#> Power against: H0: tau = 0.2*tau = 0.5*tau = 0.8*tau = tau =
#> 0 0.04 0.1 0.16 0.2
#> -----------------------------------------------------------------------------------------
#> Robust bias-corrected 0.05 0.054 0.078 0.123 0.165
#> =========================================================================================
#>
#>
# }
