Skip to content

Deviance for families with dispersion parameter #206

@palday

Description

@palday
Member

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @palday

      Issue actions

        Deviance for families with dispersion parameter · Issue #206 · JuliaStats/MixedModels.jl