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.
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, ...)
a string specifying the desired estimation method; either "ts"
for two-stage
estimation, or "g"
for G-estimation.
a string specifying the name of the exposure \(X\) in data
. This is not needed if
fitX.LZ
is specified.
a string specifying the name of the follow-up time \(T\) in data
. This is not needed if
fitT.LZ
is specified.
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"
.
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"
.
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 \(\lambda(t|L,X)\).
This argument is not used when estmethod="g"
.
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
.
logical. Should the control function \(R=X-\hat{X}\) be used when re-fitting
fitY
? This argument is not used when estmethod="g"
.
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.
a string specifying the name of the status indicator, 0="no event", 1="event".
This argument is not used when estmethod="ts"
.
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"
.
optional follow-up for estimating \(\psi\) with G-estimation.
Defaults to maximal observed follow-up time in data
.
This argument is not used when estmethod="ts"
.
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"
.
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"
.
ivah
returns an object of class "ivah"
, which inherits from
class "ivmod"
. An object of class "ivah"
is a list containing
the matched call.
input
is a list containing all input arguments
a vector containing the estimate of \(\psi\).
the variance-covariance matrix for the estimate of \(\psi\), obtained with the sandwich formula.
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.
the jacobian matrix of colMeans(estfun)
. If estmethod="g"
,
then d.estfun
is NULL.
logical. Was a solution found to the estimating equations?
the re-fitted model fitY
used in the estimation process when estmethod="ts"
.
This element is NULL when estmethod="g"
.
the ordered event times within (0,max.time). This element is NULL when estmethod="ts"
.
the estimate of \(B(t)\). This element is NULL when estmethod="ts"
.
the standard error of the estimate of \(B(t)\). This element is NULL when estmethod="ts"
.
p-value corresponding to supremum test of the null \(B(t)=0\).
This element is NULL when estmethod="ts"
.
the iid-decomposition of \(\sqrt{n}(\hat{B}(t) - B(t))\).
This element is NULL when estmethod="ts"
.
p-value corresponding to the null \(\psi=0\).
This element is NULL when estmethod="ts"
.
p-value corresponding to supremum test of the null \(B(t)=\psi\).
This element is NULL when estmethod="ts"
.
as pval_GOF_sup but now based on the Cramer Von Mises test statistic.
This element is NULL when estmethod="ts"
.
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"
.
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 \(\psi\) in the causal AH model
$$\lambda(t|L,Z,X)-\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\). 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 \(\psi\).
If estmethod="g"
, then ivah
uses G-estimation to estimate the function
\(B(t)\) in the causal AH model
$$\lambda(t|L,Z,X)-\lambda_0(t|L,Z,X)=XdB(t).$$
It also delivers an estimate of \(dB(t)\) assuming that this function is
constant across time (=\(\psi\)).
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.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab