Deviance for families with dispersion parameter
@palday is already working on this.
Since Feb 26, 2020.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 32/100
Research direction
Start in generalizedlinearmixedmodel.jl around line 301, the location shown in the loglikelihood stack trace, and trace how GLMM deviance and loglikelihood are computed for Gamma families. Compare the Julia and R outputs in the issue; done means the family dispersion parameter is included consistently and the affected calculations handle the reported Gamma case.
Written by the indexing model from the issue text.
Description
Currently, the dispersion parameter for families with one isn't taken into account when calculating the deviance for GLMMs. For example, in Julia we have:
julia> lexdec_glmm_gamma
Generalized Linear Mixed Model fit by maximum likelihood (nAGQ = 1)
rt_raw ~ 1 + Class + NativeLanguage + Class & NativeLanguage + (1 | Subject) + (1 | Word)
Distribution: Gamma{Float64}
Link: IdentityLink()
Deviance: 91.9052
Variance components:
Column Variance Std.Dev.
Word (Intercept) 0.0000 0.00000
Subject (Intercept) 1508.7803 38.84302
Number of obs: 1659; levels of grouping factors: 79, 21
Fixed-effects parameters:
──────────────────────────────────────────────────────────────────────────────
Estimate Std.Error z value P(>|z|)
──────────────────────────────────────────────────────────────────────────────
(Intercept) 563.552 6.69785 84.1393 <1e-99
Class: plant 6.43673 9.20547 0.699229 0.4844
NativeLanguage: Other 114.543 11.2587 10.1737 <1e-23
Class: plant & NativeLanguage: Other -29.3668 15.495 -1.89524 0.0581
──────────────────────────────────────────────────────────────────────────────
julia> loglikelihood(lexdec_glmm_gamma)
ERROR: MethodError: no method matching Gamma{Float64}(::Float64)
Closest candidates are:
Gamma{Float64}(::Any, ::Any) where T at /home/XXX/.julia/packages/Distributions/Vcqls/src/univariate/continuous/gamma.jl:30
Stacktrace:
[1] loglikelihood(::GeneralizedLinearMixedModel{Float64}) at /home/XXX/Work/MixedModels.jl/src/generalizedlinearmixedmodel.jl:301
[2] top-level scope at none:0
But in R we have:
R> summary(lexdec_glmm_gamma)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: Gamma ( identity )
Formula: rt_raw ~ 1 + Class * NativeLanguage + (1 | Subject) + (1 | Word)
Data: lexdec
AIC BIC logLik deviance df.resid
20339.4 20377.3 -10162.7 20325.4 1652
Scaled residuals:
Min 1Q Median 3Q Max
-1.7910 -0.5810 -0.1798 0.3265 8.2691
Random effects:
Groups Name Variance Std.Dev.
Word (Intercept) 1.533e+03 39.1482
Subject (Intercept) 1.915e+03 43.7595
Residual 4.142e-02 0.2035
Number of obs: 1659, groups: Word, 79; Subject, 21
Fixed effects:
Estimate Std. Error t value Pr(>|z|)
(Intercept) 588.839 11.955 49.255 <2e-16 ***
Classplant 4.894 11.218 0.436 0.6627
NativeLanguageOther 115.619 13.578 8.515 <2e-16 ***
Classplant:NativeLanguageOther -28.138 9.379 -3.000 0.0027 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) Clsspl NtvLnO
Classplant -0.109
NtvLnggOthr -0.044 -0.071
Clsspln:NLO 0.039 -0.085 0.034
R> deviance(lexdec_glmm_gamma)
[1] 52.56222
R> -2 * logLik(lexdec_glmm_gamma)
'log Lik.' 20325.38 (df=7)
See also lme4/lme4#375.
- Dominant language
- Julia
- Stars
- 455
- Forks
- 51
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaStats/MixedModels.jl
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
JuliaStats/MixedModels.jl#905 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
JuliaStats/MixedModels.jl#877 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
JuliaStats/MixedModels.jl#868 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
JuliaStats/MixedModels.jl#830 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
JuliaStats/MixedModels.jl#820 · 8 comments ·
All issues in JuliaStats/MixedModels.jl
Similar issues
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
path: splitext treats directory references and leading dots as extensionsPossibly taken @Hiten0305l claimed this today. Open
Difficulty 2/5 Half a day Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
JuliaRegistries/RegistryCI.jl#758 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaParallel/Hwloc.jl#93 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day