Getting AICc using fitglme

23 Ansichten (letzte 30 Tage)
Ron Efrat
Ron Efrat am 20 Okt. 2016
Kommentiert: Ernst Schwartz am 8 Jan. 2020
I am using fitglme to get a general linear mixed model, then I use the Model.ModelCriterion to get the AIC and AICc. The strange thing is that although ModelCriterion uses the function modelcriterion, which calculates AIC, AICc, CAIC and BIC, the output does not include AICc or CAIC:
A1.ModelCriterion
ans =
Model fit statistics
AIC BIC LogLikelihood Deviance
1040.1 1057.3 -515.06 1030.1
I looked into the functions creating the general linear mixed model and found out that after getting all the model criterion, it creates a table as the example above, and doesn't save the AICc result anywhere.
I am looking for a way to get this AICc score, would appreciate any idea.
Thank you

Antworten (1)

Julian Langowski
Julian Langowski am 22 Jun. 2018
Hi Ron,
I have the same question, but for the function fitlme. Is there an automatic way to get AICc? Thanks for any hints on how to solve this problem.
Best regards,
Julian
  1 Kommentar
Ernst Schwartz
Ernst Schwartz am 8 Jan. 2020
by copying out the relevant part of LinearMixedModel.m I think you can get the correct additional values using this function - however, I'm not entirely sure if model.covarianceParameters == model.slme.Psi.NumParametersExcludingSigma in all cases or if that needs to be adapted.
function crit = lmeModelFitInfos(model)
% (1) Get N and p.
N = model.NumObservations; % only contribution from subset.
p = length(model.Coefficients);
% (2) Add the fixed effects + residual variance to NumCoefficients.
stats.NumCoefficients = numel(model.covarianceParameters) + (p+1);
% (3) Get effective number of observations based on FitMethod.
switch lower(model.FitMethod)
case {'ml'}
stats.NumObservations = N;
case {'reml'}
stats.NumObservations = (N-p);
otherwise
% <entry key="BadFitMethod">''FitMethod'' must be either ''ML'' or ''REML''.</entry>
error(message('stats:LinearMixedModel:BadFitMethod'));
end
% (4) Set maximized log likelihood or maximized restricted log
% likelihood. model.LogLikelihood also accounts for observation
% weights.
stats.LogLikelihood = model.LogLikelihood;
% (5) Call modelcriterion utility function.
crit = classreg.regr.modelutils.modelcriterion(stats,'all',true);
end

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by