Learn R Programming

riskRegression (version 1.4.3)

iid: Extract i.i.d. decomposition from a Cox model

Description

Compute the influence function for each observation used to estimate the model

Usage

iidCox(object, newdata = NULL, tauHazard = NULL, keep.times = TRUE,
  store.iid = "full")

Arguments

object

object The fitted Cox regression model object either obtained with coxph (survival package) or cph (rms package).

newdata

Optional new data at which to do i.i.d. decomposition

tauHazard

the vector of times at which the i.i.d decomposition of the baseline hazard will be computed

keep.times

Logical. If TRUE add the evaluation times to the output.

store.iid

the method used to compute the influence function and the standard error. Can be "full", "approx" or "minimal". See the details section.

Value

A list containing:

  • IFbetaInfluence function for the regression coefficient.

  • IFhazardTime differential of the influence function of the hazard.

  • IFcumhazardInfluence function of the cumulative hazard.

  • calcIFhazardElements used to compute the influence function at a given time.

  • timeTimes at which the influence function has been evaluated.

  • etime1.minTime of first event (i.e. jump) in each strata.

  • etime.maxLast observation time (i.e. jump or censoring) in each strata.

  • indexObsIndex of the observation in the original dataset.

Details

If there is no event in a strata, the influence function for the baseline hazard is set to 0.

store.iid equal to "full" exports the influence function for the coefficients and the baseline hazard at each event time. store.iid equal to "approx" does the same except that the terms that do not contributes to the variance are not ignored (i.e. set to 0) store.iid equal to "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.

Examples

Run this code
# NOT RUN {
library(survival)
library(data.table)
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))
system.time(IF.cox_approx <- iidCox(m.cox, store.iid = "approx"))


IF.cox <- iidCox(m.cox, tauHazard = sort(unique(c(7,d$eventtime))))
 

# }

Run the code above in your browser using DataLab