[R] Schoenfeld Residuals

David Winsemius dwinsemius at comcast.net
Fri Apr 3 15:27:44 CEST 2009


I am not sure that ties are the only reason. If I create a few ties in  
the ovarian dataset that Therneau and Lumley provide, all I get are  
some warnings:
 > ovarian[4:5, 1] <- mean(ovarian[4:5, 1])
 > ovarian[6:8, 1] <- mean(ovarian[6:8, 1])
 > fit <- coxph( Surv(futime, fustat) ~ age + rx, ovarian)
 > temp<- cox.zph(fit)

 > plot(temp)
Warning messages:
1: In approx(xx, xtime, seq(min(xx), max(xx), length.out = 17)[2 *  :
   collapsing to unique 'x' values
2: In approx(xtime, xx, temp) : collapsing to unique 'x' values

The error message you get is requesting a finite ylim. Have you  
considered acceding with that request?

Alternative: Assuming the number of tied survival times is modest,  
have you tried jitter-ing the rem.Remtime variable a few times to see  
it the results are stable?

If the number of ties is large, then you need to review Thernaeu &  
Gramsch section 3.3

-- 
David Winsemius

On Apr 3, 2009, at 7:57 AM, Laura Bonnett wrote:

> Dear All,
>
> Sorry to bother you again.
>
> I have a model:
> coxfita=coxph(Surv(rem.Remtime/365,rem.Rcens)~all.sex,data=nearma)
> and I'm trying to do a plot of Schoenfeld residuals using the code:
> plot(cox.zph(coxfita))
> abline(h=0,lty=3)
>
> The error message I get is:
> Error in plot.window(...) : need finite 'ylim' values
> In addition: Warning messages:
> 1: In sqrt(x$var[i, i] * seval) : NaNs produced
> 2: In min(x) : no non-missing arguments to min; returning Inf
> 3: In max(x) : no non-missing arguments to max; returning -Inf
>
> My data (nearma) has a lot of rem.Remtime entries which are equal i.e
> large amounts of tied data.  If I remove the entries where this is the
> case from the dataset I get the results I want!
>
> Please can someone explain why removing paients with tied remission
> time has such an effect on the code and also how to remedy the problem
> without removing patients?
>
> Thank you very much,
>
> Laura.
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list