How can I compute the log likelihood parameter of a generalized linear model regression using Statistics Toolbox?

11 visualizaciones (últimos 30 días)
I am performing a generalized linear model regression using the GLMFIT function in Statistics Toolbox. I would like to calculate the log likelihood parameter for a fit, but it seems there is no output for this value.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 15 de En. de 2010
The second output of the GLMFIT function provides a value called "deviance". This is the log likelihood of the model plus an additive constant. You can compare the fits of models by calculating the difference of their respective deviances. This provides a direct comparison of the log likelihoods of the models and is how log likelihoods are typically used within the GLMFIT function.
You can also calculate log likelihood in the following manner:
[beta = glmfit(X,y,'poisson','link','log');
mu = glmval(beta,X,'log')
nll = -sum(log(poisspdf(y,mu)))

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by