I'm using linear mixed model on an ecology dataset. I want to test whether location and year has an impact on bird egg which were sampled from different marshes and nests. I found a slight mismatch on the results between the R function "lme" and the SPSS option "Mixed Model". Does anyone know the potential reasons for the mismatch? The differences on p-values are not big. For example, the p-value of fixed factor Year is 0.031 from R and 0.029 from SPSS, and the p-value of fixed factor Location is 0.51 from R and 0.43 from SPSS. My R code is: model1 <- lme(Results~Location+Year, data=data, random=~1|Marsh/NEST) My SPSS syntax is set as below: *Generalized Linear Mixed Models. GENLINMIXED /DATA_STRUCTURE SUBJECTS=Marsh*NEST*EGG /FIELDS TARGET=Results TRIALS=NONE OFFSET=NONE /TARGET_OPTIONS DISTRIBUTION=NORMAL LINK=IDENTITY /FIXED EFFECTS=Location Year USE_INTERCEPT=TRUE /RANDOM USE_INTERCEPT=TRUE SUBJECTS=Marsh COVARIANCE_TYPE=VARIANCE_COMPONENTS /RANDOM USE_INTERCEPT=TRUE SUBJECTS=Marsh*NEST COVARIANCE_TYPE=VARIANCE_COMPONENTS /BUILD_OPTIONS TARGET_CATEGORY_ORDER=ASCENDING INPUTS_CATEGORY_ORDER=ASCENDING MAX_ITERATIONS=100 CONFIDENCE_LEVEL=95 DF_METHOD=RESIDUAL COVB=MODEL PCONVERGE=0.000001(ABSOLUTE) SCORING=0 SINGULAR=0.000000000001 /EMMEANS TABLES=Location COMPARE=Location CONTRAST=PAIRWISE /EMMEANS TABLES=Year COMPARE=Year CONTRAST=PAIRWISE /EMMEANS_OPTIONS SCALE=ORIGINAL PADJUST=SEQSIDAK. Thank you very much! Please note that this message and any attachments may be protected by federal and/or state privacy laws and might also contain information that is privileged, confidential, and/or subject to attorney/client, attorney work product, or other similar protections. If you suspect that you are not the intended recipient of this message, please be so kind as to reply and let me know of my error and then delete the message and any attachments, without further dissemination, copying, or distribution. Thank you.
mismatch between R lme and SPSS mixed model
2 messages · Mengni Zhang, Julio Alejandro Di Rienzo
A detail about anova function, applied to lme objects is that it returns
asequential hypothesis tests. In this type of hypothesis, with unbalance in
the number of replicates for each treatment, the order of factors affects
p-values.
Usually, most software displays type III hypotesis test, which are probably
the way SPSS is reporting the anova table. The way to obtain type III sum
of squares in lme anova has 2 steps.
1. You must redefine the way factors are coded in the model matrix. If
say you have a factor named F1 y a data frame named myData, you have to use
the following sentence:
myData$F1<-C(myData$F1,contr.sum)
2. When calling anova function you need another parameter to be specified
anova(mymodel, *type="marginal"*)
You can even have differences if there are "corrections" on the denominators
degree of freedom.
Good luck