rdsampsi: Sample Size Calculations for RD Designs

View source: R/rdsampsi.R

rdsampsiR Documentation

Sample Size Calculations for RD Designs

Description

rdsampsi() performs sample size calculations for RD designs.

Usage

rdsampsi(
  data = NULL,
  cutoff = 0,
  tau = NULL,
  alpha = 0.05,
  beta = 0.8,
  samph = NULL,
  nsamples = NULL,
  all = FALSE,
  bias = NULL,
  variance = NULL,
  nratio = NULL,
  init.cond = NULL,
  plot = FALSE,
  graph.range = NULL,
  covs = NULL,
  covs_drop = TRUE,
  deriv = 0,
  p = 1,
  q = NULL,
  h = NULL,
  b = NULL,
  rho = NULL,
  kernel = "triangular",
  bwselect = "mserd",
  vce = "nn",
  cluster = NULL,
  scalepar = 1,
  scaleregul = 1,
  fuzzy = NULL,
  level = 95,
  weights = NULL,
  masspoints = "adjust",
  bwcheck = NULL,
  bwrestrict = TRUE,
  stdvars = FALSE
)

Arguments

data

a matrix (Y,R) containing the outcome variable and the running variable (as column vectors).

cutoff

the RD cutoff (default is 0).

tau

specifies the treatment effect under the alternative at which the power function is evaluated. The default is half the standard deviation of the outcome for the untreated group.

alpha

specifies the significance level for the power function. Default is 0.05.

beta

specifies the desired power. Default is 0.8.

samph

sets the bandwidths at each side of the cutoff for power calculation. The first number is the bandwidth to the left of the cutoff and the second number is the bandwidth to the right. Default values are the bandwidths used by rdrobust.

nsamples

sets the total sample size to the left, sample size to the left inside the bandwidth, total sample size to the right and sample size to the right of the cutoff inside the bandwidth to calculate the variance when the running variable is not specified. When not specified, the values are calculated using the running variable.

all

displays the power using the conventional variance estimator, in addition to the robust bias corrected one.

bias

set bias to the left and right of the cutoff. If not specified, the biases are estimated using rdrobust.

variance

set variance to the left and right of the cutoff. If not specified, the variances are estimated using rdrobust.

nratio

specifies the proportion of treated units in the window. Default is the ratio of the standard deviation of the treated to the sum of the standard deviations for treated and controls.

init.cond

sets the initial condition for the Newton-Raphson algorithm that finds the sample size. Default is the number of observations in the sample with non-missing values of the outcome and running variable.

plot

plots the power function using the conventional and robust bias corrected standard errors from rdrobust.

graph.range

range of the plot.

covs

option for rdrobust(): specifies additional covariates to be used for estimation and inference.

covs_drop

option for rdrobust(): if TRUE, it checks for collinear additional covariates and drops them. Default is TRUE.

deriv

option for rdrobust(): specifies the order of the derivative of the regression functions to be estimated.

p

option for rdrobust(): specifies the order of the local-polynomial used to construct the point-estimator.

q

option for rdrobust(): specifies the order of the local-polynomial used to construct the bias-correction.

h

option for rdrobust(): specifies the values of the main bandwidth to be used on the left and on the right of the cutoff, respectively.

b

option for rdrobust(): specifies the values of the bias bandwidth $b$ to be used on the left and on the right of the cutoff, respectively.

rho

option for rdrobust(): specifies the value of rho so that the bias bandwidth b equals b=h/rho.

kernel

option for rdrobust(): kernel function used to construct the local-polynomial estimators.

bwselect

option for rdrobust(): specifies the bandwidth selection procedure to be used.

vce

option for rdrobust(): specifies the procedure used to compute the variance-covariance matrix estimator.

cluster

option for rdrobust(): indicates the cluster ID variable used for the cluster-robust variance estimation with degrees-of-freedom weights.

scalepar

option for rdrobust(): specifies scaling factor for RD parameter of interest.

scaleregul

option for rdrobust(): specifies scaling factor for the regularization terms of bandwidth selectors.

fuzzy

option for rdrobust(): specifies the treatment status variable used to implement fuzzy RD estimation.

level

option for rdrobust(): sets the confidence level for confidence intervals.

weights

option for rdrobust(): is the variable used for optional weighting of the estimation procedure. The unit-specific weights multiply the kernel function.

masspoints

option for rdrobust(): checks and controls for repeated observations in tue running variable.

bwcheck

option for rdrobust(): if a positive integer is provided, the preliminary bandwidth used in the calculations is enlarged so that at least bwcheck unique observations are used.

bwrestrict

option for rdrobust(): if TRUE, computed bandwidths are restricted to lie withing the range of x. Default is bwrestrict=TRUE.

stdvars

option for rdrobust(): if TRUE, x and y are standardized before computing the bandwidths. Default is stdvars=TRUE.

Value

alpha

significance level

beta

desired power

tau

treatment effect under alternative hypothesis

sampsi.h.tot

total number of observations inside the window

sampsi.h.r

number of observations inside the window to the right of the cutoff

sampsi.h.l

number of observations inside the window to the left of the cutoff

N.r

Total sample size to the right of the cutoff

N.l

Total sample size to the left of the cutoff

samph.r

bandwidth to the right of the cutoff

samph.l

bandwidth to the left of the cutoff

var.r

Robust bias corrected variance to the right of the cutoff

Var.l

Robust bias corrected variance to the left of the cutoff

sampsi.h.tot.cl

implied total number of observations inside the window using conventional s.e.

sampsi.h.r.cl

number of observations inside the window to the right of the cutoff using conventional s.e.

sampsi.h.l.cl

number of observations inside the window to the left of the cutoff using conventional s.e.

no.iter

number of iterations until convergence of the Newton-Raphson algorithm

init.cond

initial condition of the Newton-Raphson algorithm

Author(s)

Matias Cattaneo, Princeton University. cattaneo@princeton.edu

Rocio Titiunik, Princeton University. titiunik@princeton.edu

Gonzalo Vazquez-Bare, UC Santa Barbara. gvazquez@econ.ucsb.edu

References

Cattaneo, M. D., R. Titiunik and G. Vazquez-Bare. (2019). Power Calculations for Regression Discontinuity Designs. Stata Journal, 19(1): 210-245.

Examples

# Toy dataset
X <- array(rnorm(2000),dim=c(1000,2))
R <- X[,1] + X[,2] + rnorm(1000)
Y <- 1 + R -.5*R^2 + .3*R^3 + (R>=0) + rnorm(1000)
# Sample size to achieve power of 0.8 against tau = 1
tmp <- rdsampsi(data=cbind(Y,R),tau=1)
# Sample size against tau = 1 including covariates
tmp <- rdsampsi(data=cbind(Y,R),tau=1,covs=X)



rdpower documentation built on June 22, 2022, 1:06 a.m.