I will refer to R and SAS examples, but this is a general statistical question.
I don't fully understand two things.
Let's assume I want to fit a model for observations repeated over time and compare if the means differ between men and women.
In SAS you can use the PROC MIXED procedure for it in 2 ways:
- using a mixed model, by employing random effects - "RANDOM" statement.
- using a Generalized Least Square linear model corrected for dependency and heteroscedasticity, using the "REPEATED" statement.
In R you can do the same using, for example:
- nlme::lme() for a mixed model
- nlme::gls() for the GLS estimated LM.
Now, in both, SAS and R cases I can define the residual covariance structure. Let's say it will be "compound symmetry".
And here I'm confused.
What does it mean to have, for example, a mixed model with "random intercept" AND select the CS (where does it apply? to random effects? to the residuals)?
from
Just having a GLS model with the CS (here I know it goes to the residuals).
What's the sense, the point to define both random effect relationships AND the residual covariance?
Exemplary code taken from the internet:
lme(weight ~ Time * Diet, BodyWeight,
random = ~1|Rat,
corr=corCompSymm(form=~1|Rat))
It specifies both random intercept (for the Rat being the cluster, experimental subject) AND also the corCompSymm - CS for the residuals.
...and I even saw there are structures for the random effects itself, for example pdCompSymm(). Same in SAS - the covariance can be set for both residuals and random effects.
What's the point to specify both relationships between random effects and residuals?