tmle.shift: Estimate the effect of a continuous treatment.

Description Usage Arguments Examples

Description

Estimate the effect of a continuous treatment.

Usage

1
tmle.shift(Y, A, W, Qn, gn, delta, tol = 1e-05, iter.max = 5, Aval)

Arguments

Y

Outcome vector

A

Treatment vector

W

Covariate matrix

Qn

Function to compute Q(A, W) = E(Y|A,W)

gn

Function to compute g(A,W) = density(A|W)

delta

Shift value of interest. I.e., compute the effect of shifting A delta units

tol

Convergence tolerance for parametric fluctuation

iter.max

Maximum of iterations

Aval

Points in the range of A to approximate integrals by Riemman sums. Must be equally spaced.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n <-100
W <- data.frame(W1 = runif(n), W2 = rbinom(n, 1, 0.7))
A <- rpois(n, lambda = exp(3 + .3*log(W$W1) - .2*exp(W$W1)*W$W2))
Y <- rbinom(n, 1, plogis(-1 + .05*A - .02*A*W$W2 + .2*A*tan(W$W1^2) -
                           .02*W$W1*W$W2 + 0.1*A*W$W1*W$W2))
fitA.0 <- glm(A ~ I(log(W1)) + I(exp(W1)):W2, family = poisson, data = data.frame(A, W))
fitY.0 <- glm(Y ~ A + A:W2 + A:I(tan(W1^2)) + W1:W2 + A:W1:W2, family =
                binomial, data = data.frame(A, W))
gn.0  <- function(A = A, W = W)dpois(A, lambda = predict(fitA.0, newdata = W,
                                                        type = "response"))
Qn.0 <- function(A = A, W = W)predict(fitY.0, newdata = data.frame(A, W,
                                                                  row.names = NULL), type = "response")
tmle00 <- tmle.shift(Y, A, W, Qn.0, gn.0, delta=2, tol = 1e-4, iter.max = 5,
                    Aval = seq(1, 60, 1))

idiazst/continuoustreat documentation built on May 18, 2019, 2:33 a.m.