CI_adpt: Adaptive Confidence Interval

View source: R/CI_intsec_RD.R

CI_adptR Documentation

Adaptive Confidence Interval

Description

Calculates the one-sided or two-sided adaptive confidence interval

Usage

CI_adpt(
  Cvec,
  Cbar,
  Xt,
  Xc,
  mon_ind,
  sigma_t,
  sigma_c,
  Yt,
  Yc,
  alpha,
  lower = TRUE,
  num_sim = 10^5,
  delta_init = 1.96,
  bmat_init_L,
  bmat_L,
  tau_res
)

Arguments

Cvec

a sequence of smoothness parameters

Cbar

the Lipschitz coefficient for the largest 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.

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).

Yt

outcome value for the treated group observations.

Yc

outcome value for the control group observations.

alpha

desired upper quantile value.

lower

calculate a lower one-sided confidence interval if TRUE; calculate a two-sided CI otherwise.

num_sim

number of simulations used to calculate the quantile; the default is 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.

bmat_init_L

the matrix of modulus values corresponding to delta_init and Cvec; it can be left unspecified.

bmat_L

the matrix of modulus values corresponding to the optimal δ and Cvec; it can be left unspecified.

tau_res

outcome value from the function tau_res; it can be left unspecified.

Details

This returns either one-sided lower CI or two-sided Bonferroni CI using the function CI_adpt_L; it seems this function will be substituted by CI_adpt_opt defined below.

Value

confidence interval endpoints.

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((1:5)/5, 1, Xt, Xc, mon_ind, sigma_t, sigma_c, Yt, Yc, 0.05, lower = FALSE)
CI_adpt((1:5)/5, 1, Xt, Xc, mon_ind, sigma_t, sigma_c, Yt, Yc, 0.05, lower = TRUE)
CI_adpt((1:5)/5, Inf, Xt, Xc, mon_ind, sigma_t, sigma_c, Yt, Yc, 0.05, lower = TRUE)

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