How to calculate AIC in glmfit?
8 views (last 30 days)
Show older comments
TingTing
on 14 Jul 2014
Commented: MURAT OKATAN
on 26 Apr 2021
Please help me with this!
How to calculate AIC in glmfit? I use gamma and log as link function.
Thanks a lot!
0 Comments
Accepted Answer
Shashank Prasanna
on 14 Jul 2014
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
1 Comment
MURAT OKATAN
on 26 Apr 2021
Note, however, that fitglm computes the model criteria using mdl.NumCoefficients as the number of parameters estimated, and mdl.NumCoefficients does not account for the dispersion parameter of the Normal, Gamma and Inverse Gaussian distributions [1]. But, according to some studies [e.g. 2,3 and 4], the dispersion parameter needs to be counted among estimated parameters in computing the model criteria in GLMs that use those distributions.
[1] MATLAB Version: 9.7.0.1261785 (R2019b) Update 3.
[2] Clifford M. Hurvich, Chih-Ling Tsai, Regression and time series model selection in small samples, Biometrika, Volume 76, Issue 2, June 1989, Pages 297–307, https://doi.org/10.1093/biomet/76.2.297.
[3] Joseph E. Cavanaugh, Unifying the derivations for the Akaike and corrected Akaike information criteria, Statistics & Probability Letters, Volume 33, Issue 2, 1997, Pages 201-208, ISSN 0167-7152, https://doi.org/10.1016/S0167-7152(96)00128-9.
[4] Burnham, K.P. and Anderson, D.R. (2002) Model Selection and Inference: A Practical Information-Theoretic Approach. 2nd Edition, Springer-Verlag, New York. (e.g. p.95 Table 2.1)
More Answers (0)
See Also
Categories
Find more on Analysis of Variance and Covariance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!