1
$\begingroup$

I want to understand more about the values of fixed effects drawn using sjp.glmer function

  library(lme4)
  library(sjPlot)
  data("sleepstudy")


  fm1 <- lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
  summary(fm1)
  sjp.glmer(fm1,type = "fe", sort = TRUE)

enter image description here

Question 1: What is this value of 35146.70 that is being shown on the plot? It is nowhere present in the model summary of fm1

Second case:

  fm2 <- lmer(log(Reaction) ~ Days + (1 | Subject), sleepstudy)
  summary(fm2)
  sjp.glmer(fm2,type = "fe", sort = TRUE)

  Fixed effects:
    Estimate Std. Error t value
  (Intercept) 5.530065   0.033060  167.27
  Days        0.033668   0.002521   13.36

Question 2: Is my interpretation correct: change in one unit in Days change the Reaction by 0.03 units on log scale?

Question 3: Also why the value again is different shown in the plot then in the model summary. enter image description here

Interestingly, if I log the value

      log(1.03)
      0.0295588

It matches the estimate shown in the mdoel summary of fm2

$\endgroup$
  • 1
    $\begingroup$ You are simply using the wrong function. You don't have a glmer object there and you are not dealing with odds ratios. Use sjp.lmer. It might be helpful to study the documentation of functions you are using. $\endgroup$ – Roland Jun 22 '18 at 7:25
3
$\begingroup$

The problem here is that the function you are using, `sjp.glmer" is for generalized linear mixed models. If you give the function such a model, you will get a sensible plot:

require(lme4)
require(sjPlot)
data("cbpp")
m1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = cbpp)
summary(m1)
sjp.glmer(m1,type = "fe", sort = TRUE)

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -1.3983     0.2312  -6.048 1.47e-09 ***
period2      -0.9919     0.3032  -3.272 0.001068 ** 
period3      -1.1282     0.3228  -3.495 0.000474 ***
period4      -1.5797     0.4220  -3.743 0.000182 ***

enter image description here

Note that each point on the plot corresponds to the odds ratio of each level of the fixed effect period relative to period=1. The odds ratios is simply the exponentials of the regression coefficients.For example:

> exp(-0.9919)
[1] 0.3708714

So when you use sjp.glmer, the function thinks you are giving it a generalized linear model, where the regression coefficients are on the log-odds scale (hence the need to expontiate them to get the odds ratios), but if you actually pass a linear model to it, it will just exponentiate the estimate anyway.

So to answer your first question:

35146.70 comes from:

> exp(10.4673)
[1] 35147.19

Question 2: Your interpretation is correct

Question 3: This is the same as question 1. The function is simply doing:

> exp(0.033668)
[1] 1.034241

Finally, using the correct functionin your first example:

sjp.lmer(fm1,type = "fe", sort = TRUE

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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