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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Mar 5 16:11:32 MET 2004


It's an inconsistency in coxph:

> coxph(Surv(1:100,rep(1,100))~1)$loglik
[1] -363.7394
> coxph(Surv(1:100,rep(1,100))~1,method="exact")$loglik
[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 at stat.rutgers.edu wrote:

> 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

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list