home *** CD-ROM | disk | FTP | other *** search
-
- _C_a_l_c_u_l_a_t_e _r_e_s_i_d_u_a_l_s _f_o_r _a _c_o_x_p_h _f_i_t. _C_a_l_c_u_l_a_t_e_s _m_a_r_t_i_n_g_a_l_e,
- _d_e_v_i_a_n_c_e, _s_c_o_r_e _o_r _S_c_h_o_e_n_f_e_l_d _r_e_s_i_d_u_a_l_s _f_o_r _a _C_o_x _p_r_o_p_o_r_-
- _t_i_o_n_a_l _h_a_z_a_r_d_s _m_o_d_e_l.
-
- resid(object,
- type=c("martingale", "deviance", "score", "schoenfeld",
- "dfbeta", "dfbetas", "scaledsch"),
- collapse, weighted=F)
-
- _A_r_g_u_m_e_n_t_s:
-
- object:
- a coxph object, output from a coxph fit.
-
- type:
- character string indicating the type of residual
- desired; the default is martingale. Only enough of the
- string to determine a unique match is required.
-
- collapse:
- Vector indicating which rows to collapse(sum) over. In
- time-dependent models more than one row data can per-
- tain to a single individual. If there were 4 individu-
- als represented by 3, 1, 2 and 4 rows of data respec-
- tively, then collapse=c(1,1,1, 2, 3,3, 4,4,4,4) could
- be used to obtain per subject rather than per observa-
- tion residuals.
-
- weighted:
- if TRUE and the model was fit with case weights, then
- the weighted residuals are returned.
-
- Value:
-
- For martingale and deviance residuals, the returned
- object is a vector with one element for each subject
- (without collapse). For score residuals it is a matrix
- with one row per subject and one column per variable.
- The row order will match the input data for the origi-
- nal fit. For Schoenfeld residuals, the returned object
- is a matrix with one row for each event and one column
- per variable. The rows are ordered by time within
- strata, and an attribute strata is attached that con-
- tains the number of observations in each strata. The
- scaled Schoenfeld residuals are used in the cox.zph
- function. The score residuals are each individual's
- contribution to the score vector. Two transformatons
- of this are often more useful: dfbeta is the approxi-
- mate change in the coefficient vector if that observa-
- tion were dropped, and 'dfbetas' is the approximate
- change in the coefficients, scaled by the standard
- error for the coefficients.
-
- For deviance residuals, the status variable may need to
- be reconstructed. For score and Shoenfeld residuals,
- the X matrix will need to be reconstructed.
-
- References:
-
- T.Therneau, P. Grambsch, and T.Fleming. "Martingale
- based residuals for survival models", Biometrika, March
- 1990.
-
- coxph
-
- _E_x_a_m_p_l_e_s:
-
- > attach(jasa1)
- > fit <- coxph(Surv(start, stop, event) ~ (age + surgery)* transplant)
- > mresid <- resid(fit, collapse=jasa1d)
-
-