Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
deviance applied to a glmer model returns the GLM deviance #375
Comments
|
I'm not sure if this helps, but we have thought about this at least a little bit: the bit below iis at the bottom of
|
|
Okay, I was missing the conditional versus unconditional distinction. I should know this but can you point me to the evaluation of the Laplace approximation to -2 * log-likelihood for a glmer model. I am trying to work from the |
|
Are you looking for https://github.com/lme4/lme4/blob/0701fdc758103e2e8b82234a255c1bd4722368b7/R/lmer.R#L657 ( or here or here https://github.com/lme4/lme4/blob/master/src/respModule.cpp#L161 (
where I think |
|
I had gotten to the I'll look at the notes by @stevencarlislewalker |
|
It's been a while now, but I believe this file is in better shape than those notes. https://github.com/lme4/lme4/blob/master/misc/logLikGLMM/logLikGLMM.R Steve Sent from my iPhone
|
|
@stevencarlislewalker Thanks. Looks like it will help a lot. |
|
@dmbates , do you think there is an issue/something we should change here, or do you think the current behaviour (with the current documentation) is adequate? PS: in response to your "I had gotten to the devCrit function" comment above: I believe that all the references to |
|
The issue that confused me initially is that By the way, I prefer not to apply adjectives like "conditional" to deviance. To me the deviance is a property of a model, data set and parameter values. So I think it is meaningful to say "the deviance of the conditional model" but not "the conditional deviance of the model". I have said many times that I don't know how to define the deviance of a GLMM or an LMM because I don't know what would constitute the saturated model. Things get tricky when you have scale parameters. However, I think that for the common cases of Bernoulli, Binomial and Poisson where there are no scale parameters it is possible to define a saturated GLMM model. Set the covariance of the random effects to zero, forcing the random effects themselves to be zero, and define the mean for each response to be the response itself. The deviance for a particular fitted model then becomes the sum of the squared deviance residuals + ldL2 + sqrL which was where we started at one time. When we have a scale factor we may need to adjust the sqrL and ldL2 values to correspond to a scale factor of 1 in the conditional model. Does any of this make sense or am I engaging in chasing my tail around the definitions again? |
that makes perfect sense, although it's nice to not have say "the deviance of the conditional model" every time you want to refer to this quantity ... Models with scale parameters often (e.g. Gamma, Gaussian) coincide with continuous distributions, in which case the saturated model has probability 1/log-likelihood 0, which simplifies some things. (Are there any discrete distributions in the exponential family with scale parameters ... ?) Other thoughts:
Desiderata for a default deviance method:
|
dmbates commentedApr 25, 2016
This may be intentional but I was a bit surprised after running
library(lme4); example(cbpp)to getThe deviance reported in the model summary is the Laplace approximation but the call to the
deviancefunction returns the sum of the squared deviance residuals (i.e.drsumfromdevcomp$cmp)