Augmented Inverse Probability Weighting estimator for the Average (Causal)
Treatment Effect. All nuisance models are here parametric (glm). For a more
general approach see the cate
implementation. In this implementation
the standard errors are correct even when the nuisance models are
misspecified (the influence curve is calculated including the term coming
from the parametric nuisance models). The estimate is consistent if either
the propensity model or the outcome model / Q-model is correctly specified.
ate(
formula,
data = parent.frame(),
weights,
offset,
family = stats::gaussian(identity),
nuisance = NULL,
propensity = nuisance,
all,
labels = NULL,
...
)
Formula (see details below)
data.frame
optional frequency weights
optional offset (character or vector). can also be specified in the formula.
Exponential family argument for outcome model
outcome regression formula (Q-model)
propensity model formula
If TRUE all standard errors are calculated (default TRUE when exposure only has two levels)
Optional treatment labels
Additional arguments to lower level functions
An object of class 'ate.targeted
' is returned. See
targeted-class
for more details about this class and its
generic functions.
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, ...)
cate
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, 1e3, seed=1)
(a <- ate(y~a|a*x|x, data=d))
#> Estimate Std.Err 2.5% 97.5% P-value
#> a=0 0.2302 0.05278 0.1268 0.3337 1.288e-05
#> a=1 0.3148 0.05466 0.2077 0.4219 8.413e-09
#> a=2 0.4961 0.04732 0.4034 0.5889 1.019e-25
#> a=3 0.6348 0.02492 0.5860 0.6836 3.667e-143
## ate(y~a, nuisance=~a*x, propensity=~x, ...)
# Comparison with randomized experiment
m0 <- cancel(m, a~x)
lm(y~a-1, sim(m0,2e4))
#>
#> Call:
#> lm(formula = y ~ a - 1, data = sim(m0, 20000))
#>
#> Coefficients:
#> a0 a1 a2 a3
#> 0.2176 0.3346 0.4103 0.6162
#>
# Choosing a different contrast for the association measures
summary(a, contrast=c(2,4))
#>
#> Augmented Inverse Probability Weighting estimator
#> Response y (Outcome model: gaussian):
#> y ~ a * x
#> Exposure a (Propensity model: logistic regression):
#> a ~ x
#>
#> Estimate Std.Err 2.5% 97.5% P-value
#> a=0 0.2302 0.05278 0.1268 0.3337 1.288e-05
#> a=1 0.3148 0.05466 0.2077 0.4219 8.413e-09
#> a=2 0.4961 0.04732 0.4034 0.5889 1.019e-25
#> a=3 0.6348 0.02492 0.5860 0.6836 3.667e-143
#>
#> Average Treatment Effect (constrast: 'a=1' - 'a=3'):
#>
#> Estimate Std.Err 2.5% 97.5% P-value
#> ATE -0.32 0.05923 -0.4361 -0.2039 6.577e-08
#>