[R] Extract BIC for coxph

Terry Therneau therneau at mayo.edu
Tue Dec 20 15:18:44 CET 2011

Milan Bouchet-Valat <nalimilan at club.fr>
On Tue, 2011-12-20 at 12:00 +0100, r-help-request at r-project.org wrote:
> > Dear all,
> > 
> > is there a function similar to extractAIC based on which I can
> extract the
> > BIC (Bayesian Information Criterion) of a coxph model?
> > I found some functions that provide BIC in other packages, but none
> of them
> > seems to work with coxph.
> Use extractAIC(), but set the 'k' argument to log(n), with n the
> number
> of observations in the models (this is explained briefly
> in ?extractAIC).
For survival models the "effective n" is the number of events rather
than the number of observations.  I believe most define BIC in this way.
For a cox model:
  > fit <- coxph(Surv(time, status) ~ wt.loss, data=lung)
  > fit$nevent

Terry Therneau

More information about the R-help mailing list