Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

Having read from the internet that glmer and lmer are similar thing (correct me if I am wrong), just glmer need to state the family, I wonder if I state the family for glmer as "gaussian", can I replicate the same result as lmer does?

mlm.3 <- lmer(formula=dv~floor*collection_date+(floor*collection_date|area_desc),data=master.df,REML=FALSE) mlm.3.mod <-glmer(formula=dv~floor*collection_date+(floor*collection_date|area_desc),data=master.df,family="gaussian")

I tried but was unable to get it to work, so I wonder if I have some misconception here.

share|improve this question

2 Answers

up vote 3 down vote accepted

Did you check the help page of lmer? It is pretty clear about the relationship between lmer and glmer:

The ‘lmer’ and ‘glmer’ functions are nearly interchangeable. If ‘lmer’ is called with a non-default ‘family’ argument the call is replaced by a call to ‘glmer’ with the current arguments. If ‘glmer’ is called with the default ‘family’, namely the ‘gaussian’ family with the identity link, then the call is replaced by a call to ‘lmer’ with the current arguments. (see the "Details" section in ?lmer)

So, if your results are not identical you need to show us your data. Also, make sure that you have applied the same estimation method, i.e. REML or ML.

Please find below a simple example that uses lmer as well as glmer. As you can see, the results are identical.

library(lme4)

(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))

(fm2 <- glmer(Reaction ~ Days + (Days|Subject), sleepstudy, family = "gaussian"))

(fm3 <- glmer(Reaction ~ Days + (Days|Subject), sleepstudy))



> (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
Linear mixed model fit by REML 
Formula: Reaction ~ Days + (Days | Subject) 
   Data: sleepstudy 
  AIC  BIC logLik deviance REMLdev
 1756 1775 -871.8     1752    1744
Random effects:
 Groups   Name        Variance Std.Dev. Corr  
 Subject  (Intercept) 612.092  24.7405        
          Days         35.072   5.9221  0.066 
 Residual             654.941  25.5918        
Number of obs: 180, groups: Subject, 18

Fixed effects:
            Estimate Std. Error t value
(Intercept)  251.405      6.825   36.84
Days          10.467      1.546    6.77

Correlation of Fixed Effects:
     (Intr)
Days -0.138
> 
> (fm2 <- glmer(Reaction ~ Days + (Days|Subject), sleepstudy, family = "gaussian"))
Linear mixed model fit by REML 
Formula: Reaction ~ Days + (Days | Subject) 
   Data: sleepstudy 
  AIC  BIC logLik deviance REMLdev
 1756 1775 -871.8     1752    1744
Random effects:
 Groups   Name        Variance Std.Dev. Corr  
 Subject  (Intercept) 612.092  24.7405        
          Days         35.072   5.9221  0.066 
 Residual             654.941  25.5918        
Number of obs: 180, groups: Subject, 18

Fixed effects:
            Estimate Std. Error t value
(Intercept)  251.405      6.825   36.84
Days          10.467      1.546    6.77

Correlation of Fixed Effects:
     (Intr)
Days -0.138
> 
> (fm3 <- glmer(Reaction ~ Days + (Days|Subject), sleepstudy))
Linear mixed model fit by REML 
Formula: Reaction ~ Days + (Days | Subject) 
   Data: sleepstudy 
  AIC  BIC logLik deviance REMLdev
 1756 1775 -871.8     1752    1744
Random effects:
 Groups   Name        Variance Std.Dev. Corr  
 Subject  (Intercept) 612.092  24.7405        
          Days         35.072   5.9221  0.066 
 Residual             654.941  25.5918        
Number of obs: 180, groups: Subject, 18

Fixed effects:
            Estimate Std. Error t value
(Intercept)  251.405      6.825   36.84
Days          10.467      1.546    6.77

Correlation of Fixed Effects:
     (Intr)
Days -0.138
share|improve this answer

The results of lmer and glmer should be identical if you specify the gaussian family for glmer.

The difference between the results of your models ist most likely due to specifying REML=FALSE for the first one but not for the second. Try specifying REML=FALSE or REML=TRUE (the default) for both models and check the results.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.