[R-sig-ME] Full Information matrix or Variance Covariance matrix in glmmTMB
Ben Bolker
bbo|ker @end|ng |rom gm@||@com
Tue Nov 7 23:40:59 CET 2023
On 2023-11-07 3:46 p.m., Olaifa, Julius wrote:
> I am trying to obtain the Fisher Information matrix or variance covariance matrix for a glmmTMB model. The model implements model$sdr$cov.fixed which returns the variance covariance matrix between the regression parameter coefficient (Beta)and the dispersiom parameter (phi).
> I however want to obtain the variance covariance matrix of both the fixed parameters and random effect covariance estimates (Beta, phi, Sigma)
I think vcov(., full = TRUE) will get what you want.
I You should be able to get this by inverting the results of
TMB::sdreport(..., getJointPrecision = TRUE), as for example:
library(glmmTMB)
data("sleepstudy", package = "lme4")
m1 <- glmmTMB(Reaction ~ Days + (Days|Subject), sleepstudy)
colnames(vcov(m1, full = TRUE))
cond1 cond2 disp
"(Intercept)" "Days" "d~(Intercept)"
theta1 theta2 theta3
"theta_Days|Subject.1" "theta_Days|Subject.2" "theta_Days|Subject.3"
If you want the joint precision/covariance matrix that also includes
the BLUPs/conditional modes:
ss <- TMB::sdreport(m1$obj, getJointPrecision = TRUE)
h <- solve(ss$jointPrecision)
You should be aware that this could get ugly for large problems; the
joint precision matrix (i.e., the inverse of covariance matrix) is
sparse/well-structured, but the joint covariance matrix is dense.
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
(Acting) Graduate chair, Mathematics & Statistics
> E-mail is sent at my convenience; I don't expect replies outside of
working hours.
More information about the R-sig-mixed-models
mailing list