# Linear mixed effects different in spss and R

#### jabeurmethnani

##### New Member
I am trying to do a linear mixed model in both SPSS and R. I have firstly run the analysis on SPSS and now I'm running it in R and i have got drastically different results. I just have started using R and I'm wondering whether one or both of my models are incorrectly specified.
In fact my study design is a randomized counterbalanced crossover design with two within subjects factors : experimental condition (3) and Time(7)
Running the analysis using a within subject general linear model gave me the same outputin both R and SPSS. I wanted to run a mixed effect anlysis including the Order as a fixed effect in addition to the experimental conditions and Time, and Participant as Random effect. the output was very different in the two softwares
Here is the syntax for both SPSS and R
SPSS Syntax
MIXED Glycémie BY cond Order Patient Time
/CRITERIA=CIN(95) MXITER(100) MXSTEP(10) SCORING(1) SINGULAR(0.000000000001) HCONVERGE(0,
ABSOLUTE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0.000001, ABSOLUTE)
/FIXED=Order cond Time cond*Time | SSTYPE(3)
/METHOD=REML
/RANDOM=Participant| COVTYPE(VC)
/EMMEANS=TABLES(OVERALL)
R :
library(lme4)
library(lmerTest)
library(car)
m = lmer(dv~ Condition* Order*Time + (1|Participant), data=dv)
Anova(m, type=3, test.statistic="F")

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I haven't done many of these in R and it has been a long time. I usually use SAS for my MLM. Although, your R code seems to me to generate a model with interactions across the three main effects and obs clustered in subjects. And is the "1', generation of an intercept?

Is it standard to have a three way interaction for treatment, order, and time? Seems OK, but that results in

y = tx + order + time + tx*order + tx*time + order*time, right?

#### jabeurmethnani

##### New Member
the "1" is for the generation of random effects? yes, exactly I just wanted to test whether my counterbalancing worked, that why i included order in the model