I am trying to wrap my head around mixed effects multilevel logistic regression. Have a look at my variables:
- y: Popularity (0 = Not popular, 1 = Popular)
- x1: Extraversion (Continuous)
- x2: Teacher experience (0 = Low, 1 = High)
And here is my code and results:
library(lme4)
library(haven)
library(tidyverse)
library(texreg)
# Load df
df <- read_sav(file ="https://github.com/MultiLevelAnalysis/Datasets-third-edition-Multilevel-book/blob/master/chapter%202/popularity/SPSS/popular2.sav?raw=true")
# Transform df
df <- df %>%
mutate(
popular = case_when(
popular < 5 ~ 0, # Not popular
popular > 4 ~ 1, # Popular
),
texp = case_when(
texp < 15 ~ 0, # Low
texp > 15 ~ 1, # High
) %>% as_factor())
model1 <- glmer(formula = popular ~ extrav + (1|class),
data = df, family = binomial(link = "logit"))
model2 <- glmer(formula = popular ~ extrav + texp + (1|class),
data = df, family = binomial(link = "logit"))
screenreg(list(model1, model2))
==================================================
Model 1 Model 2
--------------------------------------------------
(Intercept) -3.94 *** -5.31 ***
(0.35) (0.41)
extrav 0.81 *** 0.87 ***
(0.06) (0.06)
texp1 2.10 ***
(0.32)
--------------------------------------------------
AIC 2220.24 2028.88
BIC 2237.05 2051.06
Log Likelihood -1107.12 -1010.44
Num. obs. 2000 1893
Num. groups: class 100 95
Var: class (Intercept) 2.77 1.89
==================================================
*** p < 0.001, ** p < 0.01, * p < 0.05
If this was a regular logistic regression, I would interpret model 2 as the following:
- Intercept: The log-odds of being popular are -5.31 when extraversion is 0 and teacher experience is 0.
- The log-odds (or logits) of being popular increases with 0.87 when extraversion increases by one (Teacher experience is hold constant)
- The log-odds of being popular are 2.10 higher if you are in a class with high teacher experience than one with low (extraversion hold constant).
Questions
- Is this reading of the coefficients wrong when the model is mixed effects multilevel?
- What can I make of this "Var: class (Intercept)"? Why does is decrease?
- Imagine the intercept was insignificant in model 1 but turned significant in model 2. Why?