cov_calc: Covariance Between Two Estimators

View source: R/CI_intsec_RD.R

cov_calcR Documentation

Covariance Between Two Estimators

Description

Calculates the covariance between two estimators, Lhat_j(δ) and Lhat_k(δ).

Usage

cov_calc(
  delta,
  Cj,
  Ck,
  Cbar,
  Xt,
  Xc,
  mon_ind,
  sigma_t,
  sigma_c,
  ht_j,
  hc_j,
  ht_k,
  hc_k
)

Arguments

delta

a nonegative scalar value; it can be left unspecified if (ht_j, ht_k, hc_j, hc_k) are specified.

Cj

the smoothness parameter corresponding to the first estimator.

Ck

the smoothness parameter corresponding to the second estimator.

Cbar

the largest smoothness parameter.

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

ht_j

the modulus value for the treated observations, corresponding to the first smoothness parameter; it can be left unspecified if delta is specified.

hc_j

the modulus value for the contorl observations, corresponding to the first smoothness parameter; it can be left unspecified if delta is specified.

ht_k

the modulus value for the treated observations, corresponding to the second smoothness parameter; it can be left unspecified if delta is specified.

hc_k

the modulus value for the control observations, corresponding to the second smoothness parameter; it can be left unspecified if delta is specified.

Details

This corresponds to the expressions (17) and (18) of our paper.

Value

a scalar covariance value.

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]
cov_calc(1, 0.2, 0.4, 1, Xt, Xc, mon_ind, sigma_t, sigma_c)
cov_calc(1, 0.2, 0.4, Inf, Xt, Xc, mon_ind, sigma_t, sigma_c)

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