sigmaSvm: Standard Deviation Calculation by Silverman's Rule

View source: R/sd_fcns.R

sigmaSvmR Documentation

Standard Deviation Calculation by Silverman's Rule

Description

Standard deviation is calculated using the first-stage bandwidth chosen by Silverman's Rule, as in RDHonest::NPRPrelimVar.fit.

Usage

sigmaSvm(Xt, Xc, Yt, Yc, t.dir = c("left", "right"))

Arguments

Xt

n_t by k design matrix for the treated units.

Xc

n_c by k design matrix for the control units.

Yt

outcome value for the treated group observations.

Yc

outcome value for the control group observations.

t.dir

treatment direction; t.dir = "left" if x < 0 is treated. Otherwise, t.dir = "right".

Details

This works only for cases with one-dimensional running variables.

Value

a list containing conditional standard deviation estimates for treated observations (sigma.t) and control observations (sigma.c)

Examples

X <- matrix(rnorm(500 * 1), nrow = 500, ncol = 1)
tind <- X[, 1] < 0
Xt <- X[tind == 1, ,drop = FALSE]
Xc <- X[tind == 0, ,drop = FALSE]
sigma <- rep(1, 500)
sigma_t <- sigma[tind == 1]
sigma_c <- sigma[tind == 0]
Yt = 1 + rnorm(length(sigma_t), mean = 0, sd = sigma_t)
Yc = rnorm(length(sigma_c), mean = 0, sd = sigma_c)
sigmaSvm(Xt, Xc, Yt, Yc, "left")

koohyun-kwon/rdadapt documentation built on May 8, 2022, 8:49 p.m.