# Is setting a certain covariance structure between random effects and zeroing R equivalent to setting this structure exclusively in residual matrix?

I'm wondering whether setting, say, a compound symmetry covariance structure between random effects and setting the residual covariance to 0 is effectively the same as not using the random effects G covariance matrix and choosing CS in the residual one?

My goal is to model the true compound symmetry only via residual covariance structure, but I would like to be able to use the benefits of the lme4 or glmmTMB, rather than nlme::gls(). lme4 is the best equipped package, but doesn't allow to specify the residual covariance structure. glmmTMB allows, but I'm not sure whether it's done via G or R matrix.

I know, that if I use the G (random effects) covariance matrix, I have to "zero" the R one (which is, probably, by default, either the heterogeneous diagonal matrix or just homogeneous sigma*I), to avoid problems.

• In lme4 I can use control=list(sigma=1e-8))
• In glmmTMB I can use dispformula = ~0
• In nlme::gls() I don't have to do anything.

But is setting the structure via G and zeroing R the same as using the structure exclusively in R?

In other words, is (1 + factor | ID) equivalent to cs(0 + factor | ID) with zeroed R? And is this the same as using corCompSymm() in nlme::gls()?

• In glmmTMB() and for a normally distributed outcome, specifying the random-effects structure as (1 + factor | ID) will be equivalent to us(0 + factor | ID) provided that dispformula = ~ 0.
EDIT: If you instead specify cs(0 + factor | ID), then you postulate indeed a compound symmetry structure for the levels of factor. This should be equivalent to corCompSymm(form = ~ 1 | ID).