coxph.detail package:survival R Documentation _D_e_t_a_i_l_s _o_f _a _C_o_x _M_o_d_e_l _F_i_t _D_e_s_c_r_i_p_t_i_o_n: Returns the individual contributions to the first and second derivative matrix, at each unique event time. _U_s_a_g_e: coxph.detail(object, riskmat=FALSE) _A_r_g_u_m_e_n_t_s: object: a Cox model object, i.e., the result of 'coxph'. riskmat: include the at-risk indicator matrix in the output? _D_e_t_a_i_l_s: 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. _V_a_l_u_e: a list with components time: the vector of unique event times nevent: the number of events at each of these time points. means: a 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)'. nrisk: number of subjects at risk. hazard: the hazard increment. score: the contribution to the score vector (first derivative of the log partial likelihood) at each time point. imat: the contribution to the information matrix (second derivative of the log partial likelihood) at each time point. varhaz: the variance of the hazard increment. x,y: copies of the input data. strata: only 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. riskmat: a matrix with one row for each time and one column for each observation containing a 0/1 value to indicate whether that observation was (1) or was not (0) at risk at the given time point. _S_e_e _A_l_s_o: 'coxph', 'residuals.coxph' _E_x_a_m_p_l_e_s: 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,]