[R] Comparing COXPH models, one with age as a continuous variable, one with age as a three-level factor

John Sorkin jsorkin at grecc.umaryland.edu
Sun May 10 05:44:09 CEST 2009


Windows XP
R 2.8.1

I am trying to use anova(fitCont,fitCat) to compare two Cox models (coxph) one in which age is entered as a continuous variable, and a second where age is entered as a three-level factor (young, middle, old). The Analysis of Deviance Table produced by anova does not give a p value. Is there any way to get anova to produce p values?

Thank you,
John Sorkin


ANOVA results are pasted below:

> anova(fitCont,fitCat)
Analysis of Deviance Table

Model 1: Surv(Time30, Died) ~ Rx + Age
Model 2: Surv(Time30, Died) ~ Rx + AgeGrp
  Resid. Df Resid. Dev Df Deviance
1        62     147.38            
2        61     142.38  1     5.00



The entire program including the original coxph models follows:


> fitCont<-coxph(Surv(Time30,Died)~Rx+Age,data=GVHDdata)

> summary(fitCont)
Call:
coxph(formula = Surv(Time30, Died) ~ Rx + Age, data = GVHDdata)

  n= 64 
     coef exp(coef) se(coef)    z      p
Rx  1.375      3.96   0.5318 2.59 0.0097
Age 0.055      1.06   0.0252 2.19 0.0290

    exp(coef) exp(-coef) lower .95 upper .95
Rx       3.96      0.253      1.40     11.22
Age      1.06      0.946      1.01      1.11

Rsquare= 0.154   (max possible= 0.915 )
Likelihood ratio test= 10.7  on 2 df,   p=0.00483
Wald test            = 9.46  on 2 df,   p=0.0088
Score (logrank) test = 10.2  on 2 df,   p=0.00626


> fitCat<-coxph(Surv(Time30,Died)~Rx+AgeGrp,data=GVHDdata)

> summary(fitCat)
Call:
coxph(formula = Surv(Time30, Died) ~ Rx + AgeGrp, data = GVHDdata)

  n= 64 
                  coef exp(coef) se(coef)    z     p
Rx                1.19      3.27    0.525 2.26 0.024
AgeGrp[T.(15,25]] 1.98      7.26    0.771 2.57 0.010
AgeGrp[T.(25,45]] 1.61      5.02    0.806 2.00 0.045

                  exp(coef) exp(-coef) lower .95 upper .95
Rx                     3.27      0.306      1.17      9.16
AgeGrp[T.(15,25]]      7.26      0.138      1.60     32.88
AgeGrp[T.(25,45]]      5.02      0.199      1.04     24.38

Rsquare= 0.217   (max possible= 0.915 )
Likelihood ratio test= 15.7  on 3 df,   p=0.00133
Wald test            = 12.0  on 3 df,   p=0.0075
Score (logrank) test = 14.5  on 3 df,   p=0.00232


> anova(fitCont,fitCat)
Analysis of Deviance Table

Model 1: Surv(Time30, Died) ~ Rx + Age
Model 2: Surv(Time30, Died) ~ Rx + AgeGrp
  Resid. Df Resid. Dev Df Deviance
1        62     147.38            
2        61     142.38  1     5.00

John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}




More information about the R-help mailing list