How does the estimate of grand mean depend on the intra-class correlation in a simple random-effects model?
dta1 <- data.frame(Score = c(11,13,51,53,55,91,93,95,97),
SchoolID = c("S1","S1","S2","S2","S2","S3","S3","S3","S3"),
StudentID = c("P1","P2","P3","P4","P5","P6","P7","P8","P9"))
show(dta1) Score SchoolID StudentID
1 11 S1 P1
2 13 S1 P2
3 51 S2 P3
4 53 S2 P4
5 55 S2 P5
6 91 S3 P6
7 93 S3 P7
8 95 S3 P8
9 97 S3 P9
dta2 <- data.frame(Score = c(11,51,13,55,91,51,53,95,97),
SchoolID = c("S1","S1","S2","S2","S2","S3","S3","S3","S3"),
StudentID = c("P1","P2","P3","P4","P5","P6","P7","P8","P9"))
show(dta2) Score SchoolID StudentID
1 11 S1 P1
2 51 S1 P2
3 13 S2 P3
4 55 S2 P4
5 91 S2 P5
6 51 S3 P6
7 53 S3 P7
8 95 S3 P8
9 97 S3 P9
m1_mlm <- lme4::lmer(Score ~ (1 | SchoolID), data=dta1)
m1_lm <- lm(Score ~ 1, data=dta1)
sjPlot::tab_model(m1_mlm, show.p=FALSE, show.r2=FALSE)| Score | ||
|---|---|---|
| Predictors | Estimates | CI |
| (Intercept) | 53.01 | -4.91 – 110.93 |
| Random Effects | ||
| σ2 | 5.00 | |
| τ00 SchoolID | 1679.06 | |
| ICC | 1.00 | |
| N SchoolID | 3 | |
| Observations | 9 | |
summary(m1_mlm)Linear mixed model fit by REML ['lmerMod']
Formula: Score ~ (1 | SchoolID)
Data: dta1
REML criterion at convergence: 51.5
Scaled residuals:
Min 1Q Median 3Q Max
-1.328 -0.474 0.000 0.461 1.355
Random effects:
Groups Name Variance Std.Dev.
SchoolID (Intercept) 1679 40.98
Residual 5 2.24
Number of obs: 9, groups: SchoolID, 3
Fixed effects:
Estimate Std. Error t value
(Intercept) 53.0 23.7 2.24
summary(m1_lm)
Call:
lm(formula = Score ~ 1, data = dta1)
Residuals:
Min 1Q Median 3Q Max
-51.11 -11.11 -7.11 30.89 34.89
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 62.1 11.4 5.44 0.00061
Residual standard error: 34.2 on 8 degrees of freedom
結果顯示:
m2_mlm <- lme4::lmer(Score ~ (1 | SchoolID), data=dta2)
m2_lm <- lm(Score ~ 1, data=dta2)
sjPlot::tab_model(m2_mlm, show.p=FALSE, show.r2=FALSE)| Score | ||
|---|---|---|
| Predictors | Estimates | CI |
| (Intercept) | 56.36 | 26.97 – 85.74 |
| Random Effects | ||
| σ2 | 967.76 | |
| τ00 SchoolID | 104.17 | |
| ICC | 0.10 | |
| N SchoolID | 3 | |
| Observations | 9 | |
summary(m2_mlm)Linear mixed model fit by REML ['lmerMod']
Formula: Score ~ (1 | SchoolID)
Data: dta2
REML criterion at convergence: 80.4
Scaled residuals:
Min 1Q Median 3Q Max
-1.3673 -0.3429 -0.0278 1.0715 1.1400
Random effects:
Groups Name Variance Std.Dev.
SchoolID (Intercept) 104 10.2
Residual 968 31.1
Number of obs: 9, groups: SchoolID, 3
Fixed effects:
Estimate Std. Error t value
(Intercept) 56.4 12.0 4.69
summary(m2_lm)
Call:
lm(formula = Score ~ 1, data = dta2)
Residuals:
Min 1Q Median 3Q Max
-46.44 -6.44 -4.44 33.56 39.56
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 57.4 10.8 5.34 7e-04
Residual standard error: 32.3 on 8 degrees of freedom
結果顯示: