Compute the influence function for each observation used to estimate the model
iidCox(
object,
newdata,
baseline.iid,
tau.hazard,
tau.max,
store.iid,
keep.times,
return.object
)# S3 method for coxph
iidCox(
object,
newdata = NULL,
baseline.iid = TRUE,
tau.hazard = NULL,
tau.max = NULL,
store.iid = "full",
keep.times = TRUE,
return.object = TRUE
)
# S3 method for cph
iidCox(
object,
newdata = NULL,
baseline.iid = TRUE,
tau.hazard = NULL,
tau.max = NULL,
store.iid = "full",
keep.times = TRUE,
return.object = TRUE
)
# S3 method for phreg
iidCox(
object,
newdata = NULL,
baseline.iid = TRUE,
tau.hazard = NULL,
tau.max = NULL,
store.iid = "full",
keep.times = TRUE,
return.object = TRUE
)
# S3 method for CauseSpecificCox
iidCox(
object,
newdata = NULL,
baseline.iid = TRUE,
tau.hazard = NULL,
tau.max = NULL,
store.iid = "full",
keep.times = TRUE,
return.object = TRUE
)
For Cox models, it returns the object with an additional iid slot (i.e. object$iid
).
It is a list containing:
IFbeta: Influence function for the regression coefficient.
IFhazard: Time differential of the influence function of the hazard.
IFcumhazard: Influence function of the cumulative hazard.
calcIFhazard: Elements used to compute the influence function at a given time.
time: Times at which the influence function has been evaluated.
etime1.min: Time of first event (i.e. jump) in each strata.
etime.max: Last observation time (i.e. jump or censoring) in each strata.
indexObs: Index of the observation in the original dataset.
For Cause-Specific Cox models,
it returns the object with an additional iid slot for each model (e.g. object$models[[1]]iid
).
object The fitted Cox regression model object either
obtained with coxph
(survival package) or cph
(rms package).
[data.frame] Optional new data at which to do iid decomposition
[logical] Should the influence function for the baseline hazard be computed.
[numeric vector] the vector of times at which the i.i.d decomposition of the baseline hazard will be computed
[numeric] latest time at which the i.i.d decomposition of the baseline hazard will be computed. Alternative to tau.hazard
.
[character] the method used to compute the influence function and the standard error.
Can be "full"
or "minimal"
. See the details section.
[logical] If TRUE
add the evaluation times to the output.
[logical] If TRUE
return the object where the iid decomposition has been added.
Otherwise return a list (see the return section)
This function implements the first three formula (no number,10,11) of the subsection "Empirical estimates" in Ozenne et al. (2017). If there is no event in a strata, the influence function for the baseline hazard is set to 0.
Argument store.iid:
If n
denotes the sample size, J
the number of jump times, and p
the number of coefficients:
store.iid="full"
exports the influence function for the coefficients and the baseline hazard at each event time.
store.iid="minimal"
exports the influence function for the coefficients. For the
baseline hazard it only computes the quantities necessary to compute the influence function in order to save memory.
More details can be found in appendix B of Ozenne et al. (2017).
Brice Ozenne, Anne Lyngholm Sorensen, Thomas Scheike, Christian Torp-Pedersen and Thomas Alexander Gerds. riskRegression: Predicting the Risk of an Event using Cox Regression Models. The R Journal (2017) 9:2, pages 440-460.
library(survival)
library(data.table)
library(prodlim)
set.seed(10)
d <- sampleData(100, outcome = "survival")[,.(eventtime,event,X1,X6)]
setkey(d, eventtime)
m.cox <- coxph(Surv(eventtime, event) ~ X1+X6, data = d, y = TRUE, x = TRUE)
system.time(IF.cox <- iidCox(m.cox))
IF.cox.all <- iidCox(m.cox, tau.hazard = sort(unique(c(7,d$eventtime))))
IF.cox.beta <- iidCox(m.cox, baseline.iid = FALSE)
Run the code above in your browser using DataLab