Description Usage Arguments Value Examples
Targeted minimum loss based estimator (TMLE)
1 |
y |
Vector with outcome values. |
t |
Vector with binary treatment indicator. |
Q |
Conditional outcome distribution estimate. This should come in the for of an n x p matrix, where each column represents a conditional quantile. (See Kang & Schafer example) |
g |
Propensity score. |
q |
Quantile to be computed (e.g., q = 0.5 for the median.) |
A point estimate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | n.quant <- 500
formT <- T ~ X1+X2+X3+X4
formY <- Y ~ X1+X2+X3+X4
data <- KSdatagen(1000)
X <- data$X
Y <- data$Y
T <- data$T
fitT <- glm(formT, data = data.frame(T=T, X), family = binomial)
fitY1 <- lm(formY, data = data.frame(Y=Y, T=T, X), subset = T == 1)
fitY0 <- lm(formY, data = data.frame(Y=Y, T=T, X), subset = T == 0)
median1 <- predict(fitY1, newdata = data.frame(T=1, X))
median0 <- predict(fitY0, newdata = data.frame(T=0, X))
Q1 <- sapply(seq(1/n.quant, 1 - 1/n.quant, 1/n.quant),
function(q)qnorm(q, mean = median1, sd = summary(fitY1)$sigma))
Q0 <- sapply(seq(1/n.quant, 1 - 1/n.quant, 1/n.quant),
function(q)qnorm(q, mean = median0, sd = summary(fitY0)$sigma))
g1 <- trim(predict(fitT, type = 'response'))
ame <- tmle(Y, T, Q1, g1, 0.5) - tmle(Y, 1 - T, Q0, 1 - g1, 0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.