ivah: Instrumental variable estimation of the causal exposure...

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/sourcecode.R

Description

ivah performs instrumental variable estimation of the causal exposure effect in AH models with individual-level data. Below, Z, X, and T are the instrument, the exposure, and the outcome, respectively. L is a vector of covariates that we wish to control for in the analysis; these would typically be confounders for the instrument and the outcome.

Usage

1
2
3
ivah(estmethod, X, T, fitZ.L=NULL, fitX.LZ=NULL, fitT.LX=NULL, data,  
  ctrl=FALSE, clusterid=NULL, event, max.time, max.time.psi, n.sim=100, 
  vcov.fit=TRUE, ...)

Arguments

estmethod

a string specifying the desired estimation method; either "ts" for two-stage estimation, or "g" for G-estimation.

X

a string specifying the name of the exposure X in data. This is not needed if fitX.LZ is specified.

T

a string specifying the name of the follow-up time T in data. This is not needed if fitT.LZ is specified.

fitZ.L

an object of class "glm", as returned by the glm function in the stats package. This is a fitted GLM for E(Z|L). If there are no covariates, then fitZ.L may be specified as a model with an intercept only. This argument is not used when estmethod="ts".

fitX.LZ

an object of class "glm", as returned by the glm function in the stats package. This is a fitted GLM for E(X|L,Z). This argument is not used when estmethod="g".

fitT.LX

If estmethod="ts", then this is an object of class "ah", as returned by the ah function in the ivtools package. In this case it is a fitted AH model for λ(t|L,X). This argument is not used when estmethod="g".

data

a data frame containing the variables in the model. The covariates, instrument, exposure and outcome can have arbitrary names, e.g. they don't need to be called L, Z, X and T.

ctrl

logical. Should the control function R=X-\hat{X} be used when re-fitting fitY? This argument is not used when estmethod="g".

clusterid

an optional string containing the name of a cluster identification variable when data are clustered. Specifying clusterid corrects the standard errors but does not affect the estimates. This argument is not used when estmethod="g", since correction for clustered data is currently not implemented for G-estimation.

event

a string specifying the name of the status indicator, 0="no event", 1="event". This argument is not used when estmethod="ts".

max.time

optional follow-up for estimating B(t) with G-estimation. Defaults to maximal observed follow-up time in data. This argument is not used when estmethod="ts".

max.time.psi

optional follow-up for estimating ψ with G-estimation. Defaults to maximal observed follow-up time in data. This argument is not used when estmethod="ts".

n.sim

optional number of resamplings for testing goodness-of-fit of constant effects model for G-estimation. Defaults to 100. This argument is not used when estmethod="ts".

vcov.fit

logical. Should the variance-covariance matrix be computed?

...

optional arguments passed on to the nleqslv function, which is used to solve the estimating equations when estmethod="g". See the help pages for nleqslv. This argument is not used when estmethod="ts".

Details

The ivah estimates different parameters, depending on whether estmethod="ts" or estmethod="g". If estmethod="ts", then ivah uses two-stage estimation to estimate the parameter ψ in the causal AH model

λ(t|L,Z,X)-λ_0(t|L,Z,X)=m^T(L)Xψ.

Here, λ_0(t|L,Z,X) is counterfactual hazard function, had the exposure been set to 0. The vector function m(L) contains interaction terms between L and X. These are specified implicitly through the model fitY. The model fitX.LZ is used to construct predictions \hat{X}=\hat{E}(X|L,Z). These predictions are subsequently used to re-fit the model fitY, with X replaced with \hat{X}. The obtained coefficient(s) for X is the two-stage estimator of ψ.

If estmethod="g", then ivah uses G-estimation to estimate the function B(t) in the causal AH model

λ(t|L,Z,X)-λ_0(t|L,Z,X)=XdB(t).

It also delivers an estimate of dB(t) assuming that this function is constant across time (=ψ).

Value

ivah returns an object of class "ivah", which inherits from class "ivmod". An object of class "ivah" is a list containing

call

the matched call.

input

input is a list containing all input arguments

est

a vector containing the estimate of ψ.

vcov

the variance-covariance matrix for the estimate of ψ, obtained with the sandwich formula.

estfunall

a matrix of all subject-specific contributions to the estimating functions used in the estimation process. One row for each subject, one column for each parameter. If estmethod="ts", then the first columns correspond to the parameters estimated by fitX.LZ, and the last columns correspond to the parameters estimated by the re-fitted model fitY. If estmethod="g", then estfunall is NULL.

d.estfun

the jacobian matrix of colMeans(estfun). If estmethod="g", then d.estfun is NULL.

converged

logical. Was a solution found to the estimating equations?

fitY

the re-fitted model fitY used in the estimation process when estmethod="ts". This element is NULL when estmethod="g".

stime

the ordered event times within (0,max.time). This element is NULL when estmethod="ts".

B

the estimate of B(t). This element is NULL when estmethod="ts".

se_B

the standard error of the estimate of B(t). This element is NULL when estmethod="ts".

pval_0

p-value corresponding to supremum test of the null B(t)=0. This element is NULL when estmethod="ts".

eps_B

the iid-decomposition of √{n}(\hat{B}(t) - B(t)). This element is NULL when estmethod="ts".

pval_psi

p-value corresponding to the null ψ=0. This element is NULL when estmethod="ts".

pval_GOF_sup

p-value corresponding to supremum test of the null B(t)=ψ. This element is NULL when estmethod="ts".

pval_GOF_CvM

as pval_GOF_sup but now based on the Cramer Von Mises test statistic. This element is NULL when estmethod="ts".

GOF.resamp

a matrix with first row the ordered jump times in (0,max.time.bet), second row the observed test process, and the remaining rows are 50 processes sampled under the null. This element is NULL when estmethod="ts".

Note

ivah allows for weights. However, these are defined implicitly through the input models. Thus, when models are used as input to ivah, these models have to be fitted with the same weights.

Left-truncation and correction of standard errors for clustered data are currently not implemented when estmethod="g".

Author(s)

Arvid Sjolander and Torben Martinussen.

References

Martinussen T., Vansteelandt S., Tchetgen Tchetgen E.J., Zucker D.M. (2017). Instrumental variables estimation of exposure effects on a time-to-event endpoint using structural cumulative survival models. Epidemiology 73(4): 1140-1149.

Sjolander A., Martinussen T. (2019). Instrumental variable estimation with the R package ivtools. Epidemiologic Methods 8(1), 1-20.

Tchetgen Tchetgen E.J., Walter S., Vansteelandt S., Martinussen T., Glymour M. (2015). Instrumental variable estimation in a survival context. Epidemiology 26(3): 402-410.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require(ahaz)

set.seed(9)

n <- 1000
psi0 <- 0.2
psi1 <- 0.0

U <- runif(n)
L <- runif(n)
Z <- rbinom(n, 1, plogis(-0.5+L)) 
X <- runif(n, min=Z+U, max=2+Z+U)
T <- rexp(n, rate=psi0*X+psi1*X*L+0.2*U+0.2*L)
C <- 5  #administrative censoring at t=5
d <- as.numeric(T<C)
T <- pmin(T, C) 
data <- data.frame(L, Z, X, T, d)
#break ties
data$T <- data$T+rnorm(n=nrow(data), sd=0.001)

#two-stage estimation
fitX.LZ <- glm(formula=X~Z+L, data=data)
fitT.LX <- ah(formula=Surv(T, d)~X+L+X*L, data=data)
fitIV <- ivah(estmethod="ts", fitX.LZ=fitX.LZ, fitT.LX=fitT.LX, data=data, 
  ctrl=TRUE)
summary(fitIV)

#G-estimation
fitZ.L <- glm(formula=Z~L, family="binomial", data=data)
fitIV <- ivah(estmethod="g", X="X", T="T", fitZ.L=fitZ.L, data=data,  
  event="d", max.time=4, max.time.psi=4, n.sim=100)
summary(fitIV)
plot(fitIV)

ivtools documentation built on March 26, 2020, 7:14 p.m.

Related to ivah in ivtools...