[R] anova.coxph with subsets of data

Oscar Rueda Oscar.Rueda at cruk.cam.ac.uk
Wed Jan 29 15:46:55 CET 2014

Dear Dr. Therneau, 
Thanks a lot for your answer. I use your survival package often and I find it very useful.


Oscar M. Rueda, PhD.
 Postdoctoral Research Fellow, Caldas Lab, Breast Cancer Functional
 University of Cambridge. Cancer Research UK Cambridge Institute.
 Li Ka Shing Centre, Robinson Way.
 Cambridge CB2 0RE
From: Therneau, Terry M., Ph.D. [therneau at mayo.edu]
Sent: Wednesday, January 29, 2014 2:35 PM
To: Oscar Rueda; r-help at r-project.org
Subject: Re:  [R] anova.coxph with subsets of data

--- begin included message ---

But If I do

> fit <- coxph(Surv(futime, fustat) ~ resid.ds *rx + ecog.ps, data = ovarian, subset=ovarian$age>50)
>  anova(fit)
>  fit2 <- coxph(Surv(futime, fustat) ~ resid.ds +rx + ecog.ps, data=ovarian, subset=ovarian$age>50)
>  anova(fit2,fit)

The first p-value seems to be wrong.
Would anybody please explain to me why?


---- end inclusion ----

The p-value seems wrong because it is wrong.  You've found a bug in the survival package.
(It has to do with missing values, and the attempt of anova.coxph to ensure that it does
not fit a sequence of models such that an observation is dropped partway through the list.)

Terry Therneau

More information about the R-help mailing list