Open TDJorgensen opened 3 months ago
for a multilevel SEM, related to the lavaan.mi package
Specifically, the NACOV would be needed for lavResiduals()
. But I notice that lavResiduals(fit2, summary = TRUE)
is not available. So perhaps the reason is related to the structure of Gamma not being as obvious as I expect.
A partial explanation:
I'm trying to get an idea about the required structure of
@SampleStats@NACOV
for a multilevel SEM, related to thelavaan.mi
package. The unstructured model's NACOV is generally stored in a list, but I am unsure whether the list should belength(ngroups)
orlength(nblocks)
. Thevcov()
for a multigroup SEM is a single matrix because parameters can be constrained across groups, but in the unstructured h1 model, the group blocks of that matrix are independent (thus, separate in theNACOV
list). I expect same would hold for multilevel SEMs (the level-specific covariance-matrix components are independent), but maybe there is additional complexity.To see how
lavaan
provides it, I tried:Which returned an error from
lav_object_inspect_sampstat_gamma()
:When
lav_object_inspect_sampstat_gamma()
runslav_object_gamma()
, it yields a single list but with a 42x42 matrix, which I did not expect. In a simpler model without exogenous covariates:The matrix is only 9x9, when I would expect 6 (co)variances per level + 3 means at Level 2 (so 15, or 18 if 3 means are included at Level 1). I think this is leading to the error when
lav_object_inspect_sampstat_gamma()
tries to assign names.