[R] difference between coxph and cph

Frank E Harrell Jr feh3k at spamcop.net
Wed Apr 21 13:09:03 CEST 2004


On Wed, 21 Apr 2004 09:07:07 +0200
Göran Broström <gb at stat.umu.se> wrote:

> On Tue, Apr 20, 2004 at 10:01:36PM -0700, Deb Montgomery wrote:
> > Hi. I am using Windows version of R 1.8.1. Being somewhat new to
> > survival analysis, I am trying to compare cph (Design) with coxph
> > (survival) for use with a survival data set.
> > 
> > I was wondering why cph and coxph provide me with different confidence
> > intervals
> > for the hazard ratios for one of the variables. I was wondering if I
> > am doing something wrong? Or if the two functions are calculating
> > hazard ratios and the 95% confidence intervals differently? 
> 
> Yes, for 'Weight.at.age.4' you get differing parameter estimates (0.91
> versus 0.83). Want to know the correct answer? Try 'coxreg' in  package
> 'eha'! :-) 
> 
> More seriously, the difference may well be of numerical character,
> different convergence criteria, "unbalanced" data, etc. It is really
> impossible to say without knowing what your data are (and without
> looking into the code of coxph and cph).

No, cph is essentially a wrapper for coxph and uses the same computations.
 The problem is that Deb did not read the documentation to summary.Design
nor the Overview of the Design package.  The output below makes it pretty
clear that the range over which Weight.at.age.4 is being evaluated is not
an interval of length 1.0 as is assumed by coxph's summary function.  The
Design package by default computes inter-quartile-range effects.  The
quartiles in this case are apparently 8.6 and 10.6.

Frank Harrell

> 
> > I have listed part of the code
> > and part of the results from the 2 functions. Sorry if this question
> > is a repeat, I didn't find it when I searched the archives.
> > 
> > ###########################################################
> > # s= Surv(Time1, Time2, censor)
> > #f= coxph(s~  Siblings + Weight.at.age.4)
> > #summary(f)
> > #Call:
> > #coxph(formula = s ~ Siblings + Weight.at.age.4)
> > # n= 132
> > #                exp(coef) exp(-coef) lower .95 upper .95
> > #Siblings            1.52      0.657     0.815      2.84
> > #Weight.at.age.4      0.91      1.099     0.772      1.07
> > ##############################################################
> > #s= Surv(Time1, Time2, censor)
> > #f= cph(s~  Siblings + Weight.at.age.4,surv=TRUE ,  x=T, y = T)
> > # summary(f)
> > #             Effects              Response : s
> > # Factor          Low   High   Diff.  Effect S.E. Lower 0.95 Upper
> > # 0.95 Siblings       0.000  1.000 1.0000  0.42  0.32 -0.20      1.04
> > #  Hazard Ratio   0.000  1.000 1.0000  1.52    NA  0.82      2.84
> > # Weight.at.age.4 8.613 10.602 1.9885 -0.19  0.17 -0.51      0.14
> > # Hazard Ratio   8.613 10.602 1.9885  0.83    NA  0.60      1.15
> > 
> > 
> > Sincerely
> > 
> > Deb Montgomery
> > 
> > Department of Fisheries and Wildlife Resources
> > University of Idaho
> > Moscow, Idaho 83843
> > 208-885-4008
> > mont4260 at uidaho.edu
> 
> -- 
>  Göran Broström                    tel: +46 90 786 5223
>  Department of Statistics          fax: +46 90 786 6614
>  Umeå University                   http://www.stat.umu.se/egna/gb/
>  SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se

---
Frank E Harrell Jr   Professor and Chair           School of Medicine
                     Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list