?anova.coxph
will tell you that there's an additional parameter, test, taking  
values "F", "Cp", or "Chisq" which instructs the anova method to  
perform the stated test comparing the two models and spit out a p- 
value (for F and  Chisq at least).
example(anova.chisq) provides some examples.

Cheers,
Greg.
On 9-May-09, at 11:44 PM, John Sorkin wrote:

> 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 ...{{dropped:27}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to