MATLAB: How to calculate AIC in glmfit

aicfitglmglmglmfitStatistics and Machine Learning Toolbox

Please help me with this!
How to calculate AIC in glmfit? I use gamma and log as link function.
Thanks a lot!

Best Answer

It is recommended to use fitglm instead of the older glmfit. Depending on the release of MATLAB (> R2012a) you can use either of the two:
You can access AIC, BIC etc as follows:
load hospital
modelspec = 'Smoker ~ Age*Weight*Sex - Age:Weight:Sex';
mdl = fitglm(hospital,modelspec,'Distribution','binomial')
mdl.ModelCriterion
ans =
AIC: 137.141380948166
AICc: 138.358772252513
BIC: 155.377572250082
CAIC: 162.377572250082