I'm wondering if I can get AIC and BIC from GLMNet. I've found glmnet.cr that seems to be able to do it but my response is time, not ordinal. I could calculate it myself from likelihood but glmnet doesn't return that either.
Tangential: can I actually return the l1norm? I feel like it should just be
fit$norm
but it doesn't seem to be. (I know it says don't pull the numbers out but I'm actually not using the R)
Thanks in advance for the help.
I was struggling a lot with a way how to calculate AIC and BIC for glmnet models. However, after quite a lot of searching, I found on the third page of google results the answer. It can be found here. I am posting it here for future readers as I believe I cannot be the only one.
In the end, I implemented the AIC and BIC in the following way:
fit <- glmnet(x, y, family = "multinomial")
tLL <- fit$nulldev - deviance(fit)
k <- fit$df
n <- fit$nobs
AICc <- -tLL+2*k+2*k*(k+1)/(n-k-1)
AICc
BIC<-log(n)*k - tLL
BIC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With