iidCox | R Documentation |
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 class '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 class '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 class '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 class 'CauseSpecificCox'
iidCox(
object,
newdata = NULL,
baseline.iid = TRUE,
tau.hazard = NULL,
tau.max = NULL,
store.iid = "full",
keep.times = TRUE,
return.object = TRUE
)
object |
object The fitted Cox regression model object either
obtained with |
newdata |
[data.frame] Optional new data at which to do iid decomposition |
baseline.iid |
[logical] Should the influence function for the baseline hazard be computed. |
tau.hazard |
[numeric vector] the vector of times at which the i.i.d decomposition of the baseline hazard will be computed |
tau.max |
[numeric] latest time at which the i.i.d decomposition of the baseline hazard will be computed. Alternative to |
store.iid |
[character] the method used to compute the influence function and the standard error.
Can be |
keep.times |
[logical] If |
return.object |
[logical] If |
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).
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
).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.