Getting AICc using fitglme
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Julian Langowski
el 22 de Jun. de 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 comentario
Ernst Schwartz
el 8 de En. de 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
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!