ivcoxph {ivtools} | R Documentation |
Instrumental variable estimation of the causal exposure effect in Cox proportional hazards (PH) models
Description
ivcoxph
performs instrumental variable estimation of the causal exposure effect in
Cox PH 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
ivcoxph(estmethod, X, fitZ.L=NULL, fitX.LZ=NULL, fitX.L=NULL, fitT.LX=NULL,
fitT.LZX=NULL, data, formula=~1, ctrl=FALSE, clusterid=NULL, t=NULL,
vcov.fit=TRUE, ...)
Arguments
estmethod |
a string specifying the desired estimation method; either |
X |
a string specifying the name of the exposure |
fitZ.L |
an object of class |
fitX.LZ |
an object of class |
fitX.L |
an object of class |
fitT.LX |
an object of class |
fitT.LZX |
either an object of class |
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 |
formula |
an object of class |
ctrl |
logical. Should the control function |
clusterid |
an optional string containing the name of a cluster identification variable when
data are clustered. Specifying |
t |
a numeric scalar specifying the time point at which to solve the estimating
equation when |
vcov.fit |
logical. Should the variance-covariance matrix be computed? |
... |
optional arguments passed on to the |
Details
ivcoxph
estimates the parameter \psi
in the causal Cox PH model
\textrm{log}\{\lambda(t|L,Z,X)\}-\textrm{log}\{\lambda_0(t|L,Z,X)\}=m^T(L)X\psi.
Here, \lambda_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
. If estmethod="ts"
, then these are specified
implicitly through the model fitT.LX
. If estmethod="g"
, then these
are specified explicitly through the formula
argument.
If estmethod="ts"
, then two-stage estimation of \psi
is performed.
In this case, 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 fitT.LX
, with X
replaced with \hat{X}
. The obtained
coefficient(s) for \hat{X}
in the re-fitted model is the two-stage estimator of \psi
.
If estmethod="g"
, then G-estimation of \psi
is performed. In this case,
the estimator is obtained as the solution to the estimating equation
H(\psi)=\sum_{i=1}^n\hat{d}(L_i,Z_i)h_i(\psi;t)=0,
where
h_i(\psi;t)=\hat{S}(t|L_i,Z_i,X_i)^{\textrm{exp}\{-m^T(L_i)\psi X_i\}}.
The estimated function \hat{d}(L,Z)
is chosen so that the true function
has conditional mean 0, given L
; E\{d(L,Z)|L\}=0
.
The specific form of \hat{d}(L,Z)
is determined by the user-specified models.
If fitX.LZ
and fitX.L
are specified, then \hat{d}(L,Z)=m(L)\{\hat{E}(X|L,Z)-\hat{E}(X|L)\}
,
where \hat{E}(X|L,Z)
and \hat{E}(X|L)
are obtained from fitX.LZ
and fitX.L
, respectively. If these are not specified, then \hat{d}(L,Z)=m(L)\{Z-\hat{E}(Z|L)\}
,
where \hat{E}(Z|L)
is obtained from fitZ.L
, which then must be specified.
The estimating equation is solved at the value of t
specified by the argument t
.
\hat{S}(t|L_i,Z_i,X_i)
is an estimate of S(t|L_i,Z_i,X_i)
obtained
from the model fitT.LZX
.
Value
ivcoxph
returns an object of class "ivcoxph"
, which inherits from
class "ivmod"
. An object of class "ivcoxph"
is a list containing
call |
the matched call. |
input |
|
est |
a vector containing the estimate of |
vcov |
the variance-covariance matrix for the estimate of |
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 |
d.estfun |
the jacobian matrix of |
converged |
logical. Was a solution found to the estimating equations? |
fitT.LX |
the re-fitted model |
t |
the value of |
Note
ivcoxph
allows for weights. However, these are defined implicitly
through the input models. Thus, when models are used as input to ivcoxph
,
these models have to be fitted with the same weights. When estmethod="g"
the weights are taken from fitX.LZ
, if specified by the user. If fitX.LZ
is not
specified then the weights are taken from fitZ.L
. Hence, if weights are used,
then either fitX.LZ
or fitZ.L
must be specified.
Author(s)
Arvid Sjolander.
References
Martinussen T., Sorensen D.D., Vansteelandt S. (2019). Instrumental variables estimation under a structural Cox model. Biostatistics 20(1), 65-79.
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
require(survival)
set.seed(9)
##Note: the parameter values in the examples below are chosen to make
##Y0 independent of Z, which is necessary for Z to be a valid instrument.
n <- 10000
psi0 <- 0.5
Z <- rbinom(n, 1, 0.5)
X <- rbinom(n, 1, 0.7*Z+0.2*(1-Z))
m0 <- exp(0.8*X-0.41*Z) #T0 independent of Z at t=1
T <- rexp(n, rate=exp(psi0*X+log(m0)))
C <- rexp(n, rate=exp(psi0*X+log(m0))) #50% censoring
d <- as.numeric(T<C)
T <- pmin(T, C)
data <- data.frame(Z, X, T, d)
#two-stage estimation
fitX.LZ <- glm(formula=X~Z, data=data)
fitT.LX <- coxph(formula=Surv(T, d)~X, data=data)
fitIV <- ivcoxph(estmethod="ts", fitX.LZ=fitX.LZ, fitT.LX=fitT.LX, data=data,
ctrl=TRUE)
summary(fitIV)
#G-estimation with non-parametric model for S(t|L,Z,X) and model for Z
fitZ.L <- glm(formula=Z~1, data=data)
fitT.LZX <- survfit(formula=Surv(T, d)~X+Z, data=data)
fitIV <- ivcoxph(estmethod="g", X="X", fitZ.L=fitZ.L, fitT.LZX=fitT.LZX,
data=data, t=1)
summary(fitIV)
#G-estimation with Cox model for \lambda(t|L,Z,X) and model for Z
fitZ.L <- glm(formula=Z~1, data=data)
fitT.LZX <- coxph(formula=Surv(T, d)~X+X+X*Z, data=data)
fitIV <- ivcoxph(estmethod="g", X="X", fitZ.L=fitZ.L, fitT.LZX=fitT.LZX,
data=data, t=1)
summary(fitIV)