Learn R Programming

survival (version 2.34-1)

coxph.detail: Details of a Cox Model Fit

Description

Details of a Cox model fit. Returns the individual contributions to the first and second derivative matrix, at each unique event time.

Usage

coxph.detail(object)

Arguments

object
a Cox model object, i.e., the result of coxph.

Value

  • a list with components
  • timethe vector of unique event times
  • neventthe number of events at each of these time points.
  • meansa matrix with one row for each event time and one column for each variable in the Cox model, containing the weighted mean of the variable at that time, over all subjects still at risk at that time. The weights are the risk weights exp(x %*% fit$coef).
  • nrisknumber of subjects at risk.
  • hazardthe hazard increment.
  • scorethe contribution to the score vector (first derivative of the log partial likelihood) at each time point.
  • imatthe contribution to the information matrix (second derivative of the log partial likelihood) at each time point.
  • varhazthe variance of the hazard increment.
  • x,ycopies of the input data.
  • strataonly present for a stratified Cox model, this is a table giving the number of time points of component time that were contributed by each of the strata.

Details

This function may be useful for those who wish to investigate new methods or extensions to the Cox model. The example below shows one way to calculate the Schoenfeld residuals.

See Also

coxph, residuals.coxph

Examples

Run this code
fit   <- coxph(Surv(futime,fustat) ~ age + rx + ecog.ps, ovarian, x=TRUE)
fitd  <- coxph.detail(fit)
events <- fit$y[,2]==1
etime  <- fit$y[events,1]   #the event times --- may have duplicates
indx   <- match(etime, fitd$time)
sresid <- fit$x[events,] - fitd$means[indx,]

Run the code above in your browser using DataLab