I am trying to double-check the results I am getting with the matlab fitlme function by comparing it with the output of the SPSS MIXED procedure. The results of the F tests match perfectly, while the estimated coefficients vary quite a lot. In particular, for one instance they yield opposite signs. Here's the settings:
I have 77 subjects, I have 1 continuous DV (activation), 2 continuous IVs (score1 and score2) and 1 categorical IV (condition) with 2 levels. Each subject undergoes both conditions.
In matlab, I code the model as:
formula= 'activation ~ condition * score1 + condition * score2 + (condition|subject)';
lmeO= fitlme(ds, formula, 'FitMethod', 'ML', 'DummyVarCoding','effects','CovariancePattern','Isotropic');
ss=anova(lme,'DFMethod','satterthwaite');
And this is what I get:
Model information:
Number of observations 154
Fixed effects coefficients 6
Random effects coefficients 154
Covariance parameters 2
Formula:
beta ~ 1 + condition*score2 + condition*score1 + (1 + condition | subject)
Model fit statistics:
AIC BIC LogLikelihood Deviance
-1653.7 -1629.4 834.85 -1669.7
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF pValue Lower Upper
'(Intercept)' 0.00035541 0.00036932 0.96233 148 0.33745 -0.00037442 0.0010852
'condition_0' 0.0013595 0.00036932 3.681 148 0.00032481 0.00062966 0.0020893
'score2' 2.3196e-06 6.8395e-06 0.33915 148 0.73498 -1.1196e-05 1.5835e-05
'score1' -3.841e-06 3.8722e-06 -0.99193 148 0.32285 -1.1493e-05 3.811e-06
'condition_0:score2' 7.313e-06 6.8395e-06 1.0692 148 0.2867 -6.2026e-06 2.0829e-05
'condition_0:score1' -1.2532e-05 3.8722e-06 -3.2365 148 0.0014931 -2.0184e-05 -4.8805e-06
K>> ss=anova(lmeO,'DFMethod','satterthwaite')
ss =
ANOVA marginal tests: DFMethod = 'Satterthwaite'
Term FStat DF1 DF2 pValue
'(Intercept)' 0.92609 1 154 0.33739
'condition' 13.55 1 154 0.00032081
'score2' 0.11502 1 154 0.73496
'score1' 0.98393 1 154 0.32279
'condition:score2' 1.1433 1 154 0.28664
'condition:score1' 10.475 1 154 0.0014814
When I try to do exactly the same in SPSS, I code it this way:
MIXED activation BY Condition WITH score1 score2
/CRITERIA=CIN(95) MXITER(1000) MXSTEP(10) SCORING(1) SINGULAR(0.000000000001) HCONVERGE(0,
ABSOLUTE) LCONVERGE(0, ABSOLUTE) PCONVERGE(0.000001, ABSOLUTE)
/FIXED=Condition score1 score2 Condition*score1 Condition*score2 | SSTYPE(3)
/METHOD=ML
/PRINT=DESCRIPTIVES G SOLUTION TESTCOV
/REPEATED=Condition | SUBJECT(subject) COVTYPE(ID)
/EMMEANS=TABLES(Condition) COMPARE ADJ(BONFERRONI).
And this is what I get
Type III Tests of Fixed Effects
Source Numerator df Denominator df F Sig.
Intercept 1 154 .926 .337
Condition 1 154 13.550 .000
score1 1 154 .984 .323
score2 1 154 .115 .735
Condition * score1 1 154 10.475 .001
Condition * score2 1 154 1.143 .287
a Dependent Variable: activation
So, same results from the ANOVA. But the estimated coefficients are quite different:
Estimates of Fixed Effectsa
Parameter Estimate Std. Error df t Sig. 95% Confidence Interval
Intercept -.001004 .000522 154.000 -1.922 .056 -.002036 2.772913E-5
[Condition=0] .002719 .000739 154.000 3.681 .000 .001260 .004178
[Condition=1] 0b 0
score1 8.691529E-6 5.476117E-6 154 1.587 .115 -2.126475E-6 1.950953E-5
score2 -4.993413E-6 9.672506E-6 154.000 -.516 .606 -2.410133E-5 1.411451E-5
[Condition=0] * score1 -2.506497E-5 7.744399E-6 154.000 -3.237 .001 -4.036394E-5 -9.766007E-6
[Condition=1] * score1 0b 0 . . . . .
[Condition=0] * score2 1.462609E-5 1.367899E-5 154.000 1.069 .287 -1.239659E-5 4.164877E-5
[Condition=1] * score2 0b 0 . . . . .
a Dependent Variable: HbO_Beta.
b This parameter is set to zero because it is redundant.
Curiously, when I used the "reference" Dummy coding in matlab, the estimates of interactions agree, although opposite in sign, but that's because it's using th two different levels of condition, but still I get very different results on the main effects of score1 and score2:
K>> lme= fitlme(ds, formula, 'FitMethod', 'ML', 'DummyVarCoding','reference','CovariancePattern','Isotropic')
lme =
Linear mixed-effects model fit by ML
Model information:
Number of observations 154
Fixed effects coefficients 6
Random effects coefficients 154
Covariance parameters 2
Formula:
activation ~ 1 + condition*score2 + condition*score1 + (1 + condition | subject)
Model fit statistics:
AIC BIC LogLikelihood Deviance
-1653.7 -1629.4 834.85 -1669.7
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF pValue Lower Upper
'(Intercept)' 0.0017149 0.0005223 3.2833 148 0.0012802 0.00068277 0.002747
'condition_1' -0.002719 0.00073865 -3.681 148 0.0003248 -0.0041786 -0.0012593
'score2' 9.6327e-06 9.6725e-06 0.99588 148 0.32093 -9.4814e-06 2.8747e-05
'score1' -1.6373e-05 5.4761e-06 -2.99 148 0.0032685 -2.7195e-05 -5.552e-06
'condition_1:score2' -1.4626e-05 1.3679e-05 -1.0692 148 0.2867 -4.1657e-05 1.2405e-05
'condition_1:score1' 2.5065e-05 7.7444e-06 3.2365 148 0.0014931 9.7611e-06 4.0369e-05
Can anyone help me shed some light on this? How are MIXED and FITLME different in estimating the coefficients?
Thanks a lot in advance