Learn R Programming

riskRegression (version 1.3.7)

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,
  center.result = TRUE)

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.

center.result

Temporary argument. Should the IF be rescale to match timereg results.

...

additional arguments

Details

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

Examples

Run this code
library(survival)
library(data.table)
set.seed(10)
d <- sampleData(40, 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(IC.cox <- iidCox(m.cox))

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

Run the code above in your browser using DataLab