Solved – Random effects in mixed models

fixed-effects-modelmixed modelrandom-effects-modelspss

I am not very familiar with mixed models — I have been reviewing the various tutorials on the web but still am not sure how to specify my model, even as a starting point for comparison. I have a relatively simple design:

  • two non-random groups (normal/obese) — randomized within each group to two conditions (control/treatment). And the DV measured at pre and post-test.

So I am interested in looking at differences between pre and post, for the treatment vs. control and also between the two groups.

I am using SPSS — this is the syntax I've come up with so far.

MIXED Score BY Group Treatment Time
/CRITERIA=CIN(95) MXITER(200) MXSTEP(10) SCORING(5) SINGULAR(0.000000000001) HCONVERGE(0,
ABSOLUTE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0.000001, ABSOLUTE)
/FIXED=Group Treatment Group*Treatment Time Group*Time Treatment*Time Group*Treatment*Time | SSTYPE(3)
/METHOD=REML
/PRINT=G R SOLUTION TESTCOV
/RANDOM=INTERCEPT | SUBJECT(ID) COVTYPE(VC)
/REPEATED=Time | SUBJECT(ID) COVTYPE(UN)

Some of my questions —

  • I have specified a random intercept for subject ID, but do I need to account somehow that these are random effects from TWO separate populations (normal weight and obese)? If so, how would I do this?

  • It seems that I could estimate the time effect using either the REPEATED or RANDOM command (by adding time to the RANDOM). I can't figure out the difference of what that means conceptually and how to decide which fits my data or design better.

  • Is it correct to list TIME as a fixed factor? I have also seen in one of the books I'm looking at that variables have been coded as 0/1 indicators and entered as covariates. I have no idea why this was done — I can't seem to find an explanation. However, If I do this, it changes my fixed effects (even with all the same effects and interactions specified). And changes on whether the pre or post is specified as 0/1. So how does mixed models treat factors vs covariates differently? What could be the advantage of treating a variable as a covariate rather than a factor? I noted that although the tests of fixed effects changed, the estimates using EMMEANS or TEST remained the same, which I also thought was weird.

  • Does one need to account for baseline group differences, and if so how would this be done? Since my data is in long format I no longer have a pre-test measurement that I can put in as a covariate in post-test scores. Sorry if these are dumb questions — I am much more used to ANCOVA and GLM.

Best Answer

Here are my answers to your questions:

1) No, you do not need to account for the grouping here, because the random intercepts are estimated for each cluster (here, each person), not for each group--this is why you have the grouping variable in your fixed effects as a predictor of the intercept (the "main effect") or of the slopes (the interaction terms)

2) The RANDOM line specifies the random effect, which is what you seem to want. The REPEAT line is to allow for a different level-1 residual variance-covariance matrix; for example, you can allow residuals from one timepoint to be correlated with the next (autoregressive structure). In this case however, you do not need a REPEAT line, since you have only two timepoints (there is only one residual correlation to be estimated).

3) Yes, it is correct to use TIME as a fixed factor. The FIXED command simply serves to determine which fixed effects will be estimated, much like in GLM. Therefore, you do want the effect of TIME (mean difference from pre to post, controlling for other effects in your model) to be estimated. Where you decide whether to treat TIME as a factor or as a continuous predictor is in the very first line: BY denotes a categorical factor and will be automatically dummy-coded, and WITH denotes a continuous predictor. Therefore, you'd want your first line to be: MIXED Score BY Group Treatment WITH Time

4) Baseline differences between groups are embedded in the Group fixed effect, which represents the mean difference between the two groups, when $\text{Time}=0$ since there is an interaction term between Group and Time. Therefore, where you decide to center your time variable (i.e. which timepoint gets the value 0) is crucial. By including the Group fixed effect, you are controlling for differences between groups at $\text{Time}=0$.

Related Question