43  Within vs Between / Contextual Effects Visualization

Author

Josh Gilbert

Within, between, and contextual effects can be a challenge to think about or visualize. This shiny app allows you to explore different effects to build intuition about what these relationships mean, substantively, using students in schools as a context. In the graph, the big dots and black dashed line represent school means, that is, the between effect. The small dots and the multicolored lines represent individual schools, or, the within effect. The contextual effect is the difference in within and between effects (sort of like an interaction representing a “difference in slopes”). By default, it is set to 0, so the within and between effects are the same, which is the assumption of the random intercepts model. (NB The “offset” parameter is not a real MLM parameter; it just spreads out the school means on the x-axis to make the visualization more powerful)

Exercises: