# Linear mixed model for crossover trial with repeated measure levels in SPSS

I have data from a study where participants completed 3 interventions in a randomized order (1 week washout period), and where in every intervention, outcome measures were taken every 15 minutes over the intervention duration (3 time points). I therefore have two levels of repeated measures. My data in long form in SPSS looks like this:

ID Intervention Time Outcome
1 1 1 0.42
1 1 2 0.55
1 1 3 0.41
1 2 1 0.51
1 2 2 0.59
1 2 3 0.52
1 3 1 0.42
1 3 2 0.46
1 3 3 .
2 1 1 0.37
2 1 2 0.42
2 1 3 0.41

(and so on for other participants, with some sparse missing data as shown in example)

I'm trying to see the effect of the different conditions, as well as time and interaction between these factors on my outcome using a linear mixed model in SPSS. However, I am confused as to how I should input this into SPSS. I've tried putting both condition and time as repeated measures with unstructured covariance type, and this leads to the "Model cannot be fitted because number of observations is less than or equal to number of model parameters" warning.

I currently have Time, Intervention, and Time*Intervention as fixed effects in my model, and ID as a random effect, due to a random intercept between participants.

Is this a problem with the way my data is organised, how I'm running the model, or both?

Your data structure and model outline seem correct to me. I think the problem lies in the SPSS syntax you are using. You mentioned you put time and intervention in as repeated measures (I assume this happens in SPSS Mixed model dialogue). But you say you are using them as fixed effects, and not as random effects (which seems reasonable to me), so there is no need to put them into the repeated box, and actually, if you also have them as fixed effects, you can't use them as random effects. I think this is what produces the error (however, see edit at the end).

Just use participant id as a random factor (put it into the "Subjects" box in the SPSS Mixed models first dialogue box, and then specify the id-related random intercept in the random dialogue box by moving id to the right and ticking the intercept box).

I think the following syntax would also achieve the above. You may want to change some of the estimation details, I used the defaults, but I believe this is the model structure you are trying to fit (edited to add I used SPSS 29.0):

MIXED outcome BY Intervention Time
/CRITERIA=DFMETHOD(SATTERTHWAITE) CIN(95) MXITER(100) MXSTEP(10) SCORING(1)
SINGULAR(0.000000000001) HCONVERGE(0.00000001, RELATIVE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0,
ABSOLUTE)
/FIXED=Intervention Time Intervention*Time | SSTYPE(3)
/METHOD=REML
/PRINT=SOLUTION
/RANDOM=INTERCEPT | SUBJECT(id) COVTYPE(VC)
/EMMEANS=TABLES(Intervention*Time) .


EDIT January 2024 - It has come to my attention that in SPSS you can indeed put your time variable (or the variable representing the repeated element in your design, or even other kind of clustering variable) that you are using as a fixed predictor into the repeated box in order to specify this variable's residual covariance structure, if that is considered necessary. But specifying a "Repeated" variable is not a requirement for running a multilevel model in SPSS, and you can use time as fixed predictor (or as random effect) without specifying it as "Repeated".