Skip to content

vcov function in glmer or glmmTMB package

2 messages · wilson 1998, Ben Bolker

#
Hi There,

I have some questions on this package. Basically, I would like to know how the package generate the vcov or variance covariance matrix of the betas while considering the random effects.
In my simulation, for example I am using count data ?Salamanders? which is incorporated in glmmTMB package, and for example I choose the poisson model. In the first case, I thought using the idea from generalized estimating equations to get the variance of beta would give the same answer, but it proves me that the idea has not been successfully replicating the vcov output produced by glmmTMB. Would you be able to explain how the package give the output for vcov output?

So here is my attempt:
fit0 = glmmTMB(count~spp + (1|site), family=poisson)
fit1 = glmer(count~spp + (1|site), family=poisson)


vcov(fit0)
vcov(fit1)


then the output is:
Conditional model:
             (Intercept)        sppPR        sppDM      sppEC-A      sppEC-L     sppDES-L        sppDF
(Intercept)  0.100414787 -0.009259333 -0.009259333 -0.009259333 -0.009259334 -0.009259334 -0.009259333
sppPR       -0.009259333  0.046295871  0.009259332  0.009259332  0.009259333  0.009259333  0.009259332
sppDM       -0.009259333  0.009259332  0.016612285  0.009259333  0.009259333  0.009259333  0.009259333
sppEC-A     -0.009259333  0.009259332  0.009259333  0.029259437  0.009259333  0.009259333  0.009259333
sppEC-L     -0.009259334  0.009259333  0.009259333  0.009259333  0.014234439  0.009259333  0.009259333
sppDES-L    -0.009259334  0.009259333  0.009259333  0.009259333  0.009259333  0.013954163  0.009259333
sppDF       -0.009259333  0.009259332  0.009259333  0.009259333  0.009259333  0.009259333  0.017806382
7 x 7 Matrix of class "dpoMatrix"
             (Intercept)        sppPR        sppDM      sppEC-A      sppEC-L     sppDES-L        sppDF
(Intercept)  0.099481765 -0.009148415 -0.009148235 -0.009148238 -0.009148235 -0.009148193 -0.009148190
sppPR       -0.009148415  0.045738988  0.009147988  0.009147896  0.009147974  0.009147959  0.009147990
sppDM       -0.009148235  0.009147988  0.016412580  0.009147989  0.009148018  0.009148012  0.009148022
sppEC-A     -0.009148238  0.009147896  0.009147989  0.028907530  0.009147995  0.009147994  0.009147998
sppEC-L     -0.009148235  0.009147974  0.009148018  0.009147995  0.014063315  0.009148014  0.009148020
sppDES-L    -0.009148193  0.009147959  0.009148012  0.009147994  0.009148014  0.013786369  0.009148015
sppDF       -0.009148190  0.009147990  0.009148022  0.009147998  0.009148020  0.009148015  0.017592178


I tried to reproduce using the idea of Generalized estimating equations for the vcov and found very similar entries, except for the entry (1,1)

          [,1]        [,2]        [,3]        [,4]        [,5]        [,6]        [,7]
[1,]  0.009265 -0.00926500 -0.00926500 -0.00926500 -0.00926500 -0.00926500 -0.00926500
[2,] -0.009265  0.04632422  0.00926500  0.00926500  0.00926500  0.00926500  0.00926500
[3,] -0.009265  0.00926500  0.01662246  0.00926500  0.00926500  0.00926500  0.00926500
[4,] -0.009265  0.00926500  0.00926500  0.02927735  0.00926500  0.00926500  0.00926500
[5,] -0.009265  0.00926500  0.00926500  0.00926500  0.01424315  0.00926500  0.00926500
[6,] -0.009265  0.00926500  0.00926500  0.00926500  0.00926500  0.01396271  0.00926500
[7,] -0.009265  0.00926500  0.00926500  0.00926500  0.00926500  0.00926500  0.01781728


So I would like to know how do glmmTMB / glmer produce the output for vcov please?

Thankyou.

Regards,
WIlson
#
Short answer.
   I wouldn't expect GEE and GLMM approaches to give the same answers at 
all, they're solving different problems.  Agresti's book on categorical 
data analysis has one entire chapter on each approach (Chapters 11 and 12).


http://www.math.mcmaster.ca/bolker/misc/agresti_cond_marg.png

    Another reference (for ecologists):

Muff Stefanie, Held Leonhard, Keller Lukas F., and Matthiopoulos Jason. 
?Marginal or Conditional Regression Models for Correlated Non?normal 
Data?? Methods in Ecology and Evolution 7, no. 12 (August 30, 2016): 
1514?24. https://doi.org/10.1111/2041-210X.12623.

  Others may be able to suggest better references.

   As for the technical question:

* the details of the derivation of var-cov for lmer are in J Stat 
Software Bates et al. 2015
* glmmTMB uses general-purpose optimization  + Laplace approximation 
(which is exact in the LMM case)
On 2/18/21 7:46 AM, wilson 1998 wrote: