Skip to content

Application of step to coxph using method="exact" (PR#6646)

2 messages · John Kolassa, Brian Ripley

#
Full_Name: John E. Kolassa
Version: Version 1.8.1
OS: Solaris
Submission from: (NULL) (128.6.76.36)


Stepwise model selection for coxph appears to fail with method="exact".
The code

step(coxph(Surv(1:100,rep(1,100))~factor(rep(1:4,25)),method="exact"))

produces the error message 

Start:  AIC= 733.07 
 Surv(1:100, rep(1, 100)) ~ factor(rep(1:4, 25)) 

Error in "[<-"(`*tmp*`, i + 1, , value = extractAIC(nfit, scale, k = k,  : 
        number of items to replace is not a multiple of replacement length

The same code without specifying method 
step(coxph(Surv(1:100,rep(1,100))~factor(rep(1:4,25))))

runs through, and gives what looks like a reasonable answer.  Thanks, John
Kolassa
#
It's an inconsistency in coxph:
[1] -363.7394
[1] -363.7394 -363.7394

so you are blaming the wrong code.  According to the documentation, the 
first is incorrect.  However, this did not arise with the original 
stepAIC, as coxph in S-PLUS cannot handle the second model, and I suspect 
the fix for it in R is inconsistent.

I am about to change extractAIC.coxph to work around this.
On Thu, 4 Mar 2004 kolassa@stat.rutgers.edu wrote: