Learn R Programming

targeted (version 0.3)

ate: AIPW estimator for Average Treatement Effect

Description

Augmented Inverse Probability Weighting estimator for the Average (Causal) Treatment Effect.

Usage

ate(
  formula,
  data = parent.frame(),
  weights,
  binary = TRUE,
  nuisance = NULL,
  propensity = nuisance,
  all,
  missing = FALSE,
  labels = NULL,
  ...
)

Value

An object of class 'ate.targeted' is returned. See targeted-class

for more details about this class and its generic functions.

Arguments

formula

Formula (see details below)

data

data.frame

weights

optional frequency weights

binary

Binary response (default TRUE)

nuisance

outcome regression formula

propensity

propensity model formula

all

If TRUE all standard errors are calculated (default TRUE when exposure only has two levels)

missing

If TRUE a missing data (AIPW) estimator is returned

labels

Optional treatment labels

...

Additional arguments to lower level functions

Author

Klaus K. Holst

Details

The formula may either be specified as: response ~ treatment | nuisance-formula | propensity-formula

For example: ate(y~a | x+z+a | x*z, data=...)

Alternatively, as a list: ate(list(y~a, ~x+z, ~x*z), data=...)

Or using the nuisance (and propensity argument): ate(y~a, nuisance=~x+z, ...)

Examples

Run this code
m <- lvm(y ~ a+x, a~x)
distribution(m,~ a+y) <- binomial.lvm()
d <- sim(m,1e3,seed=1)

a <- ate(y ~ a, nuisance=~x, data=d)
summary(a)

# Multiple treatments
m <- lvm(y ~ a+x, a~x)
distribution(m,~ y) <- binomial.lvm()
m <- ordinal(m, K=4, ~a)
transform(m, ~a) <- factor
d <- sim(m, 1e4, seed=1)
(a <- ate(y~a|a*x|x, data=d))

# Comparison with randomized experiment
m0 <- cancel(m, a~x)
d0 <- sim(m0,2e5)
lm(y~a-1,d0)

# Choosing a different contrast for the association measures
summary(a, contrast=c(2,4))

Run the code above in your browser using DataLab