-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LRT for comparing non-mixed to mixed models #508
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4d23eb1
LRT for comparing non-mixed to mixed models
palday 5accab7
nesting for LM/GLMM and GLM/LMM
palday f8614cd
NEWS entry
palday f2c25d4
use _iscomparable instead of isnested
palday b8ea015
add missing dep
palday 231f0e0
inner has no more preds than outer, thx @kleinschmidt
palday 04bbda4
Merge branch 'main' of github.com:JuliaStats/MixedModels.jl into pa/u…
palday 01763e2
column span check
palday b777afc
oops
palday dae16e2
julia 1.4 compat
palday 0371a0e
condition LRT show method on G/LMM
palday b952a67
use deviance for GLM and -2 loglikelihood for LMM
palday ecc9de3
Merge branch 'main' of github.com:JuliaStats/MixedModels.jl into pa/u…
palday 82636ff
contains -> occursin (Julia 1.4 compat)
palday 6c29191
Apply suggestions from code review
palday 31cff45
copy-paste error
palday af7b2e3
Merge branch 'pa/unmixedlrt' of github.com:JuliaStats/MixedModels.jl …
palday 070cc73
reenable a shortcut
palday eb6b59b
Apply suggestions from code review
palday 0d70a7b
Merge branch 'pa/unmixedlrt' of github.com:JuliaStats/MixedModels.jl …
palday File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmbates I can feel you looking over my shoulder and shaking your head when I write something like "the deviance isn't really the deviance". 🙂 Do you have a better way of handling / labelling this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The important point is that the difference in -2 log likelihood is the same as the difference in deviances would be if they could be calculated. Of course, now that I have written that I wonder if it makes sense when comparing a LinearModel and a LinearMixedModel. We know what the saturated model for a LinearModel is but we don't for a LinearMixedModel. My statement seems to indicate that the deviance for the saturated model in a LinearMixedModel would then have to be the same as that of a LinearModel but I am not sure that makes sense. I am starting to confuse myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad I'm not the only one who struggles with some of this stuff. 😄
I think the relevant bit here is actually that the test statistic for LRT is -2 log(L_1/L2) which then is just the difference of -2 log likelihood. Using the true deviance was always just a convenience because the additive constants cancel out, when both models have the same constant.
All that said, my question is: should we change the label of that column and/or the internal fields? I would prefer to keep the internal fieldnames, but changing the
show
method's output is trivial.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. For a linear mixed model it would be more accurate to label the column as
-2 loglik
. For a GLMM I think it should bedeviance
. I believe that for aBinomial
GLMM that is not alsoBernoulli
(e.g.cbpp
) the quantity in that column will not be-2 loglik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, that is true. And indeed the
loglikelihood
anddeviance
for GLMM are defined independently.Let me see what it would take to add a conditional to the
show
method --I think we'll need to add something to theLikelihoodRatioTest
struct because right now there is no notion of which model it came from.