waq: Estimate treatment effects under additivity by weighting...

Description Usage Arguments Value Examples

View source: R/waq.R

Description

Efficiently estimate the treatment effect under an additive model based on taking a weighted average of the quantile differences:

∑_{i} w(X_{(i)}) (Y_{(i)} - X_{(i)}) / ∑_{i} w(X_{(i)})

where w(X_{(i)}) is the (estimated) second derivative of the log density of the control, and subscripts (i) indicate that the vectors are sorted. If X and Y are not of the same length, elements of the shorter vector are duplicated appropriately.

Usage

1
2
3
4
5
6
7
8
9
waq(
  X,
  Y,
  xf = NULL,
  d2_logf = NULL,
  truncate_wf = TRUE,
  return_weights = TRUE,
  ...
)

Arguments

X

numeric vector, the outcomes of the control observations.

Y

numeric vector, the outcomes of the treated observations.

xf

numeric vector, points at which the density is given in d2_logf. If xf is NULL but d2_logf is supplied, it is assumed that the density was estimated at each points in X.

d2_logf

numeric vector, (estimates of) the second derivative of the log density of the control observations X. If d2_logf is null, the density (and its derivatives) of X is estimated using estimate_density_d_logs.

truncate_wf

logical, should weights be truncated if (normalized) w/f is too large? (default TRUE)

return_weights

logical, should the weights be returned?

...

additional arguments passed on estimate_density_d_logs for density estimation.

Value

list of two elements (three if return_weights is TRUE):

tau

the point estimate of the treatment effect

se

the estimated standard error

w

(if return_weights is TRUE) weights, length equal to length of longer of X and Y, in order of sorted X and Y

Examples

1
2
3
4
# draw a random sample with additive treatment effect
X <- rexp(n=1000, rate=2)
Y <- 0.5 + rexp(n=200, rate=2)
waq(X,Y)

michaelpollmann/parTreat documentation built on Dec. 21, 2021, 5:58 p.m.