| vcovHC.glmmTMB | R Documentation |
This method for vcovHC computes the cluster-robust
variance-covariance matrix for a glmmTMB model fitted with ML.
## S3 method for class 'glmmTMB'
vcovHC(x, type = "HC0", sandwich = TRUE, ...)
x |
a |
type |
only "HC0" is currently supported for |
sandwich |
logical; if |
... |
additional arguments passed to |
The sandwich estimator is computed as B * M * B where
B is the bread matrix and M is the meat matrix.
The bread matrix is just the usual inverse Hessian obtained by
vcov(). The meat matrix is calculated as the sum of the cluster-wise
score vector cross-products.
A square matrix representing the cluster-robust variance-covariance matrix.
m <- glmmTMB(count ~ mined + (1 | spp), data = Salamanders, family = nbinom1)
# Standard variance-covariance matrix:
vcov(m)$cond
# Cluster-robust variance-covariance matrix:
vcovHC(m)
# Include the variance parameters:
vcovHC(m, full = TRUE)
# This can be compared with:
vcov(m, full = TRUE)
# Only look at the meat part:
vcovHC(m, sandwich = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.