[R-sig-ME] Random effects variances in R and SPSS not matching
Phillip Alday
me @end|ng |rom ph||||p@|d@y@com
Wed Mar 31 22:36:05 CEST 2021
Without more information, we don't know for sure that the models are the
same in both languages.
It's too much of a time sink for a human to change model details
randomly until the output matches some expected output, but you could
probably do something with genetic programming or simulated annealing to
do that....
But if you can get more information, I would start by making sure
- that the contrasts are truly the same
- assumed covariance structures are the same
- that one language isn't dropping some observations that the other is
keeping (check the reporting number of observations levels of the
grouping var)
- the estimation method is the same across languages (ML,REML; hopefully
SPSS isn't using something like quasi-likelihood)
- different optimizers (if available) give the same result across
languages (i.e. make sure you're not in a local optimum)
- cross checking the result against yet another software package
For example, cross-checking against lme4 immediately hints that this
model might not be advisable / have a well-defined optimum:
> m2.4 <- lmer(value ~0 + name + (0 + name| Student), data = dat,
REML=FALSE)
Error: number of observations (=1600) <= number of random effects
(=1600) for term (0 + name | Student); the random-effects parameters and
the residual variance (or scale parameter) are probably unidentifiable
Phillip
On 31/3/21 10:15 pm, Simon Harmel wrote:
> Dear All,
>
> For my reproducible model below, SPSS gives the variance component of
> 119.95 for Y1, and 127.90 for Y2.
>
> But in `nlme::lme()` my variance components are 105.78 for Y1 and 113.73
> for Y2.
>
> Can we make the `lme()` reproduce the SPSS's variance components?
>
> #======= Data and R code:
> dat <- read.csv('https://raw.githubusercontent.com/hkil/m/master/mv.l.csv')
>
> library(nlme)
>
> m2 <- lme(value ~0 + name, random = ~0 + name| Student, data = dat, method
> = "ML")
>
> Random effects variance covariance matrix
> nameY1 nameY2
> nameY1 105.780 60.869
> nameY2 60.869 113.730
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list