'Difference in R and SPSS LMM output
I am working on a linear mixed model and am attempting to run one on the same data in r and spss. I'm using a treatment with two levels, looking at 10 different regions, and using length as a covariate. I have treatment and region as fixed factors, ID as a random factor, and length as a covariate. When I do this, I get different outputs (significance/p value) but the estimated means are the same. I'm not sure why the outputs are different, is anyone able to identify what in my code might be resulting in these differences?
Thank you!
R code:
library(lme4)
library(lmerTest)
library(emmeans)
library(nloptr)
lmm <- data
treatment <- factor(lmm$treatment, levels = c(1,2), labels = c("treatment A", "treatment B"))
region <- factor(lmm$region , levels = c(1,2,3,4,5,6,7,8,9,10))
MMlmm <- lmer(lmm$score~ treatment*region +lmm$length + (1|lmm$ï..ID))
anova(MMlmm, test.statistic="F")
library(pbkrtest)
res <- emmeans(MMlmm, pairwise~treatment | region)
SPSS code:
MIXED score BY region Treatment ID WITH length
/CRITERIA=DFMETHOD(SATTERTHWAITE) CIN(95) MXITER(100) MXSTEP(10) SCORING(1)
SINGULAR(0.000000000001) HCONVERGE(0, ABSOLUTE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0.000001, ABSOLUTE)
/FIXED=Treatment region region*Treatment | NOINT SSTYPE(3)
/METHOD=REML
/RANDOM=ID | COVTYPE(VC)
/FIXED = Treatment region region*Treatment
/REPEATED=region | SUBJECT(ID) COVTYPE(DIAG)
/EMMEANS=TABLES(Treatment) COMPARE REFCAT(FIRST) ADJ(LSD)
/EMMEANS=TABLES(Region) COMPARE ADJ(LSD)
/EMMEANS=TABLES(Treatment*Region) COMPARE(Treatment) ADJ(LSD).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|