# Re: [R] Cox Proportional Hazards model with a time-varying covariate

From: Terry Therneau <therneau_at_mayo.edu>
Date: Fri, 01 Apr 2011 06:49:36 -0500

> The R results I'm getting are similar to the SAS results but not very
> close. For example, my coefficient for TRT is .2913 in R but SAS
> gives .3450. I'd like to be able to run the R Code with method =
> "exact" to make it as same as the AS example but I can't seem to get
> it to work

You need to read the documentation more carefully. The "exact partial likelihood" (Cox's label, not mine), which is appropriate for data on a discreete time scale, is invoked by the "exact" option for ties in R and by using the "discrete" option in SAS. (In hindsight I actually like their choice of a label somewhat better, since users more often make the correct association of method to data.) This method can take nearly forever to compute, however, when there are a lot of subjects tied at a given time. For instance at time 20 your data set has 10 events out of 77 subjects; the term in the exact partial likelihood requires a sum over all the possible subsets of 10 chosen from 77, approximately 10^12 terms: you might retire before it finishes.

The "exact marginal likelihood" proposed by Prentice is invoked in SAS using ties=exact, it is not implimented in R. I have never found any compelling reason to program it.

Statistical comment: in statistics an "exact" method means that the solution can be computed exactly, the label has absolutely no connection with the question of whether the method is a sensible thing to do. In the case of a Cox model, I prefer and strongly recommend using the Efron approximation for ties, this is the default in R. The Breslow approximation is usually quite good enough, this is the default in SAS.

Terry Therneau

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. Received on Fri 01 Apr 2011 - 11:53:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Apr 2011 - 12:40:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.