| school_data | R Documentation |
A simulated two-level dataset with students nested within schools, designed to illustrate multilevel moderation analysis. The true data-generating model includes a cross-level interaction between student socioeconomic status and school climate.
school_data
A data frame with 3,000 rows and 6 variables:
A factor indicating the school identifier (1–100).
An integer indicating the student identifier (1–3000).
A numeric mathematics achievement score.
A numeric student socioeconomic status variable (standardized).
A numeric school climate rating (standardized level-2 variable).
A factor indicating student gender with levels "female" and "male".
The data were generated from the model
math_{ij} = 50 + 1.5\,ses_{ij} + 0.8\,climate_j +
0.5\,ses_{ij} climate_j + u_{0j} + u_{1j} ses_{ij} + e_{ij}.
The level-2 random effects were generated as u_{0j} \sim N(0, 9) and
u_{1j} \sim N(0, 0.25), and the level-1 residuals were generated as
e_{ij} \sim N(0, 25).
data(school_data)
head(school_data)
str(school_data)
library(lme4)
mod <- lmer(math ~ ses * climate + gender + (1 + ses | school),
data = school_data)
mlm_probe(mod, pred = "ses", modx = "climate")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.