[R-sig-ME] How to generate the equation of a GLMM?

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Tue Dec 8 23:36:57 CET 2020



On 12/8/20 9:43 AM, Marina Pastor wrote:
> Dear all,
> I have to obtain the equation of a GLMM. I hoped to do it using the 
> equatiomatic package, but it does not generate the equations for GLMM. 
> Any other package to generate it?
> I have two different GLMMs:
> - For the first one (glmer.nb(Zooplankton ~ offset(filtered volume) + 
> Temp + Sal + (1|stationNumber), data)) I think I managed to generate the 
> equation manually (the coefficients are below), but what I should add as 
> offset?
> The equation: Y = 20.57 + 1.17 Temp -2.12 Sal +ai
> ai ~ N(0, 1.32^2)
> The coefficients:
> Random effects:
>   Groups        Name        Variance Std.Dev.
>   stationNumber (Intercept) 1.702    1.324
> Number of obs: 72, groups:  stationNumber, 72
> 
> Fixed effects:
>              Estimate Std. Error z value Pr(>|z|)
> (Intercept)  20.5694    12.6924   2.182  0.00146 **
> Temp          1.1716     0.2222   3.823 2.41e-05 ***
> Sal          -2.1222     0.3710  -6.450 4.04e-05 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

   (1) You could always run the same model with lmer() and run the 
results through equatiomatic: that would tell you the equation of the 
*linear predictor*. You could combine that with the results of running 
equatiomatic on the model _without_ the random effect in MASS::glm.nb 
and running that through equatiomatic as well.

   (2) the offset is simply added to the RHS of the equation
   (3) You almost certainly want to be using log(filtered volume) rather 
than filtered volume itself as your offset.

   Suggestion 1 should work for your other equation as well ...
> 
> 
> - For the other GLMM (glmer.nb(Zooplankton ~ offset(filtered volume) + 
> Light * Depth + (1|stationNumber), data)), how can I generate the 
> equation? What to put as offset?
> The coefficients are:
> Random effects:
>   Groups  Name        Variance Std.Dev.
>   Station (Intercept) 1.865    1.365
> Number of obs: 102, groups:  Station, 51
> 
> Fixed effects:
>                              Estimate Std. Error  z value Pr(>|z|)
> (Intercept)                 -2.31986    0.53036 -32.290  < 2e-7 ***
> Light_2N                    -0.24249    0.03018   -2.852 0.000117 ***
> FIni_Depth_Net_m25           1.46617    0.35821    0.301 0.193128
> Light_2N:FIni_Depth_Net_m25  1.07005    0.66873    1.095 0.001965 **
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> 
> Many thanks in advance for your time and help,
> All the best!
> Marina Pastor
>



More information about the R-sig-mixed-models mailing list