[R] Calculating AICc using conditional logistic regression

Charles C. Berry cberry at tajo.ucsd.edu
Tue Dec 12 20:49:45 CET 2006


On Tue, 12 Dec 2006, K.Boughey at uea.ac.uk wrote:

> I have a case-control study that I'm analysing using the conditional
> logistic regression function clogit from the survival package.
>
> I would like to calculate the AICc of the models I fit using clogit.
>
> I have a variety of scripts that can calculate AICc for models with a
> logLik method, but clogit does not appear to use this method.
>
> Is there a way I can calculate AICc from clogit in R?

Review

 	?logLik
 	?coxph.object

and then roll your own logLik.coxph.

Here is one version:

logLik.coxph <-
     function(object,...) {
         y <-  -1 * (object$loglik[1] - object$loglik[2])
         class(y) <- "logLik"
         attr(y,'df')<- sum(!is.na(object$coef))
         y
}

Try it like this:
> fit <- clogit(case ~ spontaneous + induced + strata(stratum), data = 
infert)
> logLik(fit)
'log Lik.' 26.57712 (df=2)
>

[...]

Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717



More information about the R-help mailing list