plot.cox.zph            package:survival            R Documentation

_G_r_a_p_h_i_c_a_l _T_e_s_t _o_f _P_r_o_p_o_r_t_i_o_n_a_l _H_a_z_a_r_d_s

_D_e_s_c_r_i_p_t_i_o_n:

     Displays a graph of the scaled Schoenfeld residuals, along with a
     smooth curve.

_U_s_a_g_e:

     ## S3 method for class 'cox.zph':
     plot(x, resid=TRUE, se=TRUE, df=4, nsmo=40, var, ...)

_A_r_g_u_m_e_n_t_s:

       x: result of the 'cox.zph' function. 

   resid: a logical value, if 'TRUE' the residuals are included on the
          plot, as well as the smooth fit. 

      se: a logical value, if 'TRUE', confidence bands at two standard
          errors will be added. 

      df: the degrees of freedom for the fitted natural spline, 'df=2'
          leads to a linear fit. 

    nsmo: number of points used to plot the fitted spline. 

     var: the set of variables for which plots are desired.  By
          default, plots are produced in turn for each variable of a
          model.  Selection of a single variable allows other features
          to be added to the plot, e.g., a horizontal line at zero or a
          main title.

          This has been superseded by a subscripting method; see the
          example below. 

     ...: additional arguments passed to the 'plot' function. 

_S_i_d_e _E_f_f_e_c_t_s:

     a plot is produced on the current graphics device.

_S_e_e _A_l_s_o:

     'cox.zph', 'coxph'

_E_x_a_m_p_l_e_s:

     vfit <- coxph(Surv(time,status) ~ trt + factor(celltype) +
                   karno + age, data=veteran, x=TRUE)
     temp <- cox.zph(vfit)
     plot(temp, var=5)      # Look at Karnofsy score, old way of doing plot
     plot(temp[5])     # New way with subscripting
     abline(0, 0, lty=3)
     # Add the linear fit as well 
     abline(lm(temp$y[,5] ~ temp$x)$coefficients, lty=4, col=3) 
     title(main="VA Lung Study")

