Closed olbeck closed 5 months ago
The fm1$post_vars
contains the posterior variance-covariance matrices in the same order as fm1$post_modes
. I will assign the correct names to it to make it clear. Thanks for reporting.
The attr(, "L")
in fm1$D
denotes the elements of the Choleski factor of the prior covariance matrix of the random effects.
I am running a zero-inflated mixed model where I am interested in the estimated covariance matrix of the random effects as well as the posterior variances/covariances of the random effects for both the zeros and the counts. However, the items inside the
post_vars
andD
elements from the model output are unnamed. I have made a reproducible example that closely follows the example on the GLMMadaptive Article here.In this example, I assign letters to be the random effects for each subject (not necessarily in alphabetical order).
With the following output for
fm1$post_modes
;Output for
fm1$post_vars
:And output for
fm1$D
:In this model the random effects names are "P", "V" , "E", "L", "O", "I" , "X", "F", "Z", "D" which are reflected in the
fm1$post_modes
in alphabetical order. However, thefm1$post_vars
has ten matrices with1:10
as the name for the first matrix andNA
for the remainder matrix names. Infm1$post_vars
I do not know which matrix refers to which random effect. Is it in order or appearance inDF
? Or is it alphabetical?Additionally, in the output of
fm1$D
, what do the values of,refer to? I can calculate that
sqrt(0.03844453) = 0.1960728
andsqrt(1.18660506) = 1.0345656
which makes me assume the first and third term and the standard deviations of the count and zeros random effects, respectively. But what is the0.3409971
value? Is this the estimated correlation coefficient between the counts and zeros random effects? If this is the case, why is the0.06686024
on the off diagonals offm1$D
since0.1960728 * 0.3409971 = 0.06686024
. Using the reference from the GLMMadaptive Basics page here, I had assumed the model's covariance structure of the random effects would be$$\begin{bmatrix} \sigma^2{i, counts } & \rho \sigma{i, counts } \sigma{i, zeros } \ \rho \sigma{i, counts } \sigma{i, zeros } & \sigma^2{i, zeros } \end{bmatrix}$$
Is this a correct assumption for the structure of the covariance when using the
random
andzi_random
arguments?Any clarification on the naming inside the
fm1$post_vars
andfm1$D
outputs would be very helpful! Thank you!