# [R] difference between coxph and cph

Göran Broström gb at stat.umu.se
Wed Apr 21 09:07:07 CEST 2004

```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).

> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
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

```

More information about the R-help mailing list