K.Boughey at uea.ac.uk
2006-Dec-12 18:07 UTC
[R] Calculating AICc using conditional logistic regression
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? Many thanks, Katherine Boughey -- School of Environmental Sciences University of East Anglia Norwich NR4 7TJ
Charles C. Berry
2006-Dec-12 19:49 UTC
[R] Calculating AICc using conditional logistic regression
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