Hi, Thank you for your comments and apologies for the delay in replying. rem.Rcens =1 for the censored variables. The problem arises because I am not strictly looking at time to death. Instead I am looking at time to 12-month remission in epilepsy. Therefore a lot of people have the same event i.e. they successfully achieve 12-month remission from day 1 of the treatment.
I think I shall avoid the problem by 'excluding' patients with immediate 12-month remission i.e. I will look at patients with immediate success in a separate analysis to patients with delayed success. Thanks for your help, Laura 2009/4/6 Terry Therneau <thern...@mayo.edu>: > 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: > >> fit <- coxph(Surv(rem.Remtime, rem.Rcens) ~ all.sex, nearma) >> cfit <- cox.zph(fit) >> plot(cfit) > 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. >> plot(cfit, df=2) > 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 > >> fit2 <- coxph(Surv(rem.Remtime, rem.Rcens==0) ~ all.sex, nearma) > > Terry Therneau > > > > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.