Skip to content
Prev 16857 / 20628 Next

(no subject)

(please keep r-sig-mixed-models in the Cc:)

  I'm pretty sure that lmer and lm models are commensurate, in case that
helps.  Here's an example rigged to make the random-effects variance
equal to zero, so we can check that the log-likelihoods etc. are identical.

set.seed(101)
dd <- data.frame(y=rnorm(20),x=rnorm(20),f=factor(rep(1:2,10)))
library(lme4)
m1 <- lmer(y~x+(1|f),data=dd,REML=FALSE) ## estimated sigma^2_f=0
m2 <- lm(y~x,data=dd)
all.equal(c(logLik(m1)),c(logLik(m2))) ## TRUE
all.equal(fixef(m1),coef(m2))
anova(m1,m2)
On 2018-08-01 11:41 PM, Peter Paprzycki wrote: