Skip to content
Prev 176261 / 398503 Next

Schoenfeld residuals

Laura Bonnett was kind enough to send me a copy of the data that caused the 
plotting error, since it was an error I had not seen before.

1. The latest version of survival gives a nicer error message:
Error in plot.cox.zph(cfit) : 
   Spline fit is singular, try a smaller degrees of freedom

2. What's the problem?
  There are 1085 events in the data set (rem.Rcens==1), and of these 502 are 
tied events on exactly day 365.  The plot.cox.zph function tries to fit a 
smoothing spline to the data to help the eye; the fit gives weight 1 to each 
death and having this high a proportion of ties creates problems for the 
underlying regression.
  
3.
Warning messages:
1: In approx(xx, xtime, seq(min(xx), max(xx), length = 17)[2 * (1:8)]) :
  collapsing to unique 'x' values
2: In approx(xtime, xx, temp) : collapsing to unique 'x' values

  These warning messages are ignorable.  I'll work on making them go away.
  	
  	
4. A shot in the dark -- is perchance the variable rem.Rcens=1 a marker of a 
censored observation, and the events are 0?  (A whole lot of events at 1 year is 
suspicious, but half censored at one year is believable.) Then the proper coxph 
code is
Terry Therneau