CI_adpt_opt: Adaptive Confidence Interval with Optimal Lipschitz...

View source: R/CI_intsec_RD.R

CI_adpt_optR Documentation

Adaptive Confidence Interval with Optimal Lipschitz Coefficients

Description

Constructs an adaptive lower CI after choosing the optimal sequence of Lipschitz coefficients.

Usage

CI_adpt_opt(
  C_l,
  C_u,
  C,
  Xt,
  Xc,
  mon_ind,
  Yt,
  Yc,
  alpha,
  se.method = c("nn", "supplied", "nn.test"),
  sigma_t,
  sigma_c,
  sigma_t.init,
  sigma_c.init,
  J,
  se.init = c("Silverman", "supplied", "supp.sep", "S.test"),
  t.dir = c("left", "right"),
  n_grid = 10,
  gain_tol = 0.05,
  ratio = TRUE,
  p = Inf,
  n_sim = 10^5,
  delta_init = 1.96,
  N = 3
)

Arguments

C_l

lower end of the adaptation range.

C_u

upper end of the adaptation range.

C

the Lipschitz coefficient for the function space we consider.

Xt

n_t by k design matrix for the treated units.

Xc

n_c by k design matrix for the control units.

mon_ind

index number for monotone variables.

Yt

outcome value for the treated group observations.

Yc

outcome value for the control group observations.

alpha

desired upper quantile value.

se.method

standard deviation estimation methods.

sigma_t

standard deviation of the error term for the treated units (either length 1 or n_t).

sigma_c

standard deviation of the error term for the control units (either length 1 or n_c).

sigma_t.init

supplied first-stage variance for treated observations.

sigma_c.init

supplied first-stage variance for control observations.

J

a positive integer; if specified, the sequence of Lipschitz coefficients is set to be J equidistant grids in (C_l, C_u), without the optimal choice procedure.

se.init

the standard deviation estimation method for choosing an optimal estimator.

t.dir

treatment direction; t.dir = "left" if x < 0 is treated. Otherwise, t.dir = "right". This should specified only for one-dimensional cases.

n_grid

number of grid points to evaluate the lengths.

gain_tol

stopping criterion when finding the optimal J.

ratio

the ratio measure is used if TRUE; otherwise, the difference measure is used.

p

the order of l_1-norm; the default is Inf.

n_sim

number of simulated observations to calculate the expectation of the minimum of multivariate normal random variables; the default is n_sim = 10^5.

delta_init

the value of δ to be used in simulating the quantile; theoretically, its value does not matter asymptotically. Its default value is 1.96.

N

number of nearest neighbors to match when doing the variance estimation.

Details

This function also supports variance estimation.

Examples

n <- 500
d <- 2
X <- matrix(rnorm(n * d), nrow = n, ncol = d)
tind <- X[, 1] < 0 & X[, 2] < 0
Xt <- X[tind == 1, ,drop = FALSE]
Xc <- X[tind == 0, ,drop = FALSE]
mon_ind <- c(1, 2)
sigma <- rnorm(n)^2 + 1
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)
CI_adpt_opt(0.1, 1, 2, Xt, Xc, mon_ind, Yt, Yc, 0.05, "supplied", sigma_t, sigma_c, J = 5,
se.init = "supplied")
d <- 1
X <- rnorm(n)
tind <- X < 0
Xt <- X[tind == 1]
Xc <- X[tind == 0]
mon_ind <- 1
sigma <- rep(1, n)
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)
CI_adpt_opt(0.1, 1, 2, Xt, Xc, mon_ind, Yt, Yc, 0.05, "nn", se.init = "Silverman",
t.dir = "left")
CI_adpt_opt(1, 1, 2, Xt, Xc, mon_ind, Yt, Yc, 0.05, "nn", se.init = "Silverman",
t.dir = "left")

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