Skip to content

glmmTMB's variance-covariance matrix is of the vector of observed intercept per subject minus the quantity of the fixed intercept plus the random-intercept term?

2 messages · Sun, John, Ben Bolker

#
Dear All,

I am writing to ask which random-vector glmmTMB estimates the variance-covariance matrix. Is the random-vector that glmmTMB the G-matrix Charles Roy Henderson describes in https://en.wikipedia.org/wiki/Mixed_model?

Suppose we have a model with random-intercepts and fixed-effects. Is the random-vector that glmmTMB estimates the variance-covariance of equal to the actual random-intercept of the individual minus the quantity of the random-effect plus the fixed-intercept effect?

The random-intercept for some individual equals the intercept's random-effect plus the fixed-effect of the intercept plus some random-error scalar drawn from a normal distribution. 
I refer to the equation in the second level of the two-level model. 

The level one equation equals alpha_i+beta*Xij + epsilon_i. 
The level two: alpha_i=delta+gamma_i + h_i.

"I" is subject, j is timepoint. Delta is fixed-intercept term, gamma_i is individual's deviation from the fixed-intercept. h_i is some deviation of the individual from the fixed-effect drawn from some normal distribution. 

Best regards,
John
#
glmmTMB doesn't explicitly use Henderson's equations, but the 
variance-covariance matrix estimated by glmmTMB (and all of the other R 
mixed-model packages I can think of) is *almost* the G-matrix as 
described there.  Not quite, though, because the covariance matrices 
given by R are the covariance matrices for the random effects b within a 
**single level of the grouping variable**; as written in the Wikipedia 
page, the full covariance matrix of u would include all the blocks. For 
example, if we had (for example) 10 groups in a single-level, 
intercept-only model, u would be a 10-vector and G would be a 10x10 
diagonal matrix with the among-group variance on the diagonal. VarCorr() 
would return a list of length 1 (since there's only a single grouping 
variable in the model) containing a 1x1 covariance matrix containing the 
among-group variance.

    For a random-slopes model, u would be length 20 and G would be a 
block-diagonal matrix with 10 2x2 blocks, each of which contained the 
intercept variance, slope variance, and intercept-slope covariance. 
VarCorr() would return a list of length 1 containing a 2x2 covariance 
matrix.

   The lme4 vignette (vignette("lmer", package = "lme4")) does a pretty 
good job of describing these structures.  The algorithm used is 
completely different from glmmTMB's, and some of the internal structures 
are different (e.g. glmmTMB doesn't explicitly set up a Lambda factor, 
or internally scale the random-effects covariance matrix relative to the 
residual variance), but it may be helpful.
On 2022-10-10 5:50 p.m., Sun, John wrote:
I'm not 100% sure what you mean, but the random effects are indeed 
defined as *deviations* of the group-level expectation from the 
population-level (fixed-effect) predictions. So I think I would say 
"yes" to this question (although I will emphasize that there is no 
subtraction going on anywhere -- the group-level effects are indeed the 
sum of the fixed effects and the group-level deviations).