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
/FIXED=Group Treatment Group*Treatment Time Group*Time Treatment*Time Group*Treatment*Time | SSTYPE(3)

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.


1 Answer 1


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$.

  • $\begingroup$ Hello Patrick and thank you for the responses! I have a few follow up questions (2): Are you suggesting I add the time effect (slope) to the random effects? Or simply remove the repeated. Also with two time points there is only one covariance, but two variances (and these are different). Do I not need model this somehow? (3/4): I am confused about whether you are suggesting I treat time as a factor or covariate. Thanks again! $\endgroup$
    – Nancy
    Commented Aug 31, 2013 at 16:07
  • $\begingroup$ (2) You are right, I forgot about the 2 residual variances. By default the two of them are constrained to equality, and I don't think it matters much whether you leave you the /REPEATED line or not. You can look in the help files of SPSS for possible structures (DIAG, VC, AR1, ...). (3) You should treat time as a continuous variable and not a categorical variable (i.e. precede it with WITH and not BY), because in "real life" time is continuous, not separated into categories. $\endgroup$ Commented Aug 31, 2013 at 17:04
  • $\begingroup$ So if I remove /REPEATED, should I add time to the /RANDOM effects, and specify the covariance structure that way? Sorry I'm just having a hard time understanding the difference. $\endgroup$
    – Nancy
    Commented Aug 31, 2013 at 17:53
  • $\begingroup$ Those are two different things. The /RANDOM line specifies the random effects, it's got nothing to do with the level-1 residual variance-covariance matrix. Whether to put time in the /RANDOM line is the choice of whether to allow the effect of time to vary across individuals or not. Unless you have theoretical reasons to think that change over time does not vary at all from person to person, you should probably include a random effect for time. $\endgroup$ Commented Aug 31, 2013 at 18:03
  • $\begingroup$ OK thank you -- that is what I thought. So if I know the variances at the two times are not equal, should I keep time as /REPEATED to specify an unequal variance structure? Or is this not necessary. Above you mentioned you didn't think it mattered, and that is what I'm confused about. You have been so helpful I will try to make this my last question! $\endgroup$
    – Nancy
    Commented Aug 31, 2013 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.