[R] Getting AIC from lrm in Design package
Kyle Werner
kylewerner10 at gmail.com
Sun Oct 25 14:24:53 CET 2009
I am trying to obtain the AICc after performing logistic regression
using the Design package. For simplicity, I'll talk about the AIC. I
tried building a model with lrm, and then calculating the AIC as
follows:
likelihood.ratio <-
unname(lrm(succeeded~var1+var2,data=scenario,x=T,y=T)$stats["Model
L.R."]) #Model likelihood ratio???
model.params <- 2 #Num params in my model
AIC = -2*log(likelihood.ratio) + 2 * model.params
However, this is almost certainly the wrong interpretation. When I
replace var1 and var2 by runif(N,0,1) (that is, random variables), I
obtain better (lower) AICs than when I use real var1 and var2 that are
known to be connected with the outcome variable. Indeed, when I use
GLM instead of LRM, the real model has a lower AIC than that with the
predictors replaced by random values. Therefore, it appears that lrm's
"Model L.R." is not actually the model likelihood ratio, but instead
something else.
Going to the Design documentation, lrm.fit states that "Model L.R." is
the model likelihood-ratio chi-square. Does this mean that it is
returning 2*log(likelihood)? If so, AIC becomes
AIC = -[Model L.R.] + 2*model.params
Can anyone confirm that this final formula for obtaining the AIC from
lrm is correct?
Thanks!
More information about the R-help
mailing list