[R] Cox Proportional Hazards model with a time-varying covariate
Terry Therneau
therneau at mayo.edu
Fri Apr 1 13:49:36 CEST 2011
> 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
More information about the R-help
mailing list