[R-sig-ME] comparison bet. mixed and ols model (using lme4)

Simon Harmel @|m@h@rme| @end|ng |rom gm@||@com
Wed Sep 16 18:41:19 CEST 2020


Hello all,

In my regular, non-mixed-effects model below (`ols2`), I have just used the
average of each cluster as DV and used a binary cluster-level predictor
(sector) in the model.

# Questions: Should the amount of total variation in `ols2` model equal the
between-cluster variation (tau_00) in a corresponding mixed-effects model
(`m1`)?

Thank you, Simon

library(lme4)
library(tidyverse)

hsb <- read.csv('
https://raw.githubusercontent.com/rnorouzian/e/master/hsb.csv')
hsb_ave <- hsb %>% group_by(sch.id) %>% mutate(math_ave = mean(math)) %>%
slice(1)

ols2 <- lm(math_ave ~ sector, data = hsb_ave)

m1 <- lmer(math ~ sector + (1|sch.id), data = hsb)

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list