This workflow explains and probes a cross-level interaction in a linear growth model. It asks whether students’ rates of change differ across levels of a person-level moderator, then translates the interaction into conditional trajectories, simple slopes, and a continuous region-of-significance review.
The fixed-effects portion is:
\[ Y_{it}=\beta_0+\beta_1(Time_{it})+\beta_2(Moderator_i)+\beta_3(Time_{it}\times Moderator_i)+\cdots \]
The conditional time slope is \(\beta_1+\beta_3(Moderator_i)\). Consequently, the time main effect is the rate of change when the centered moderator equals zero.
Rows: 1,560
Columns: 6
$ student_id <chr> "G001", "G001", "G001", "G001", "G001", "G001", "G002"~
$ time <dbl> 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, ~
$ progress <dbl> 33.5, 35.2, 37.9, 41.6, 32.9, 38.5, 59.8, 58.3, 71.0, ~
$ self_efficacy <dbl> 30.9, 30.9, 30.9, 30.9, 30.9, 30.9, 51.5, 51.5, 51.5, ~
$ self_efficacy_c <dbl> -18.68, -18.68, -18.68, -18.68, -18.68, -18.68, 1.92, ~
$ program <fct> Enhanced, Enhanced, Enhanced, Enhanced, Enhanced, Enha~
| students | records | observed_outcomes | missing_outcomes | students_with_changing_moderator |
|---|---|---|---|---|
| 260 | 1560 | 1495 | 65 | 0 |
The moderator is grand-mean centered. Zero therefore represents the sample-average self-efficacy score, making the time main effect the expected rate of change for an average student.
| term | estimate | std_error | df | t_value | p_value | conf_low | conf_high |
|---|---|---|---|---|---|---|---|
| (Intercept) | 48.047 | 0.528 | 1233 | 90.996 | 0 | 47.011 | 49.083 |
| time | 2.164 | 0.061 | 1233 | 35.543 | 0 | 2.045 | 2.284 |
| self_efficacy_c | 0.338 | 0.039 | 257 | 8.751 | 0 | 0.262 | 0.414 |
| programEnhanced | 3.013 | 0.756 | 257 | 3.986 | 0 | 1.525 | 4.502 |
| time:self_efficacy_c | 0.070 | 0.006 | 1233 | 11.691 | 0 | 0.059 | 0.082 |
| model | call | Model | df | AIC | BIC | logLik | Test | L.Ratio | p-value |
|---|---|---|---|---|---|---|---|---|---|
| main_effect_model | lme.formula(fixed = progress ~ time + self_efficacy_c + program, data = analysis_data, random = ~time | student_id, method = “ML”, na.action = na.fail, control = lmeControl(opt = “optim”)) | 1 | 8 | 8652.023 | 8694.503 | -4318.012 | NA | NA | |
| interaction_model | lme.formula(fixed = progress ~ time * self_efficacy_c + program, data = analysis_data, random = ~time | student_id, method = “ML”, na.action = na.fail, control = lmeControl(opt = “optim”)) | 2 | 9 | 8543.618 | 8591.407 | -4262.809 | 1 vs 2 | 110.405 | 0 |
The interaction coefficient is the expected change in the time slope for a one-point increase in self-efficacy. Its practical meaning is clearer after probing values that fall within the observed moderator distribution.
| label | self_efficacy | self_efficacy_c | estimate | std_error | t_value | p_value | conf_low | conf_high |
|---|---|---|---|---|---|---|---|---|
| Low (-1 SD) | 39.412 | -10.168 | 1.449 | 0.086 | 16.920 | 0 | 1.281 | 1.618 |
| Mean | 49.580 | 0.000 | 2.164 | 0.061 | 35.603 | 0 | 2.045 | 2.284 |
| High (+1 SD) | 59.748 | 10.168 | 2.879 | 0.087 | 33.237 | 0 | 2.709 | 3.049 |
Simple slopes describe change at selected moderator values. They do not test whether those selected slopes differ from each other; the interaction coefficient provides that test.
This is a grid of pointwise conditional-slope intervals across the observed moderator range. It is not a simultaneous confidence band or an exact Johnson-Neyman boundary. The pattern is sensitive to model form and standard errors; do not extrapolate beyond observed support or use the plot as a substitute for the interaction test.
Probe only after checking the functional form of time and moderator, random-effects structure, residual covariance, influential students, overlap across moderator values, and missing-data assumptions.
A linear mixed-effects growth model was fitted to 1495 observations from 260 students. Baseline self-efficacy was grand-mean centered using one value per student. The time-by-self-efficacy interaction was 0.07, 95% CI [0.059, 0.082], p < .001. The interval supported a more positive rate of change at higher self-efficacy.
The estimated change per wave was 1.45 at one standard deviation below the mean, 95% CI [1.28, 1.62], p < .001; 2.16 at the mean, 95% CI [2.05, 2.28], p < .001; and 2.88 at one standard deviation above the mean, 95% CI [2.71, 3.05], p < .001. These conditional estimates should be interpreted with the trajectory plot, moderator distribution, diagnostics, and study design.
| file |
|---|
| synthetic_growth_interaction_data.csv |
| interaction_model_fixed_effects.csv |
| simple_slopes.csv |
| conditional_slope_grid.csv |
| model_comparison.csv |
| conditional_trajectories.csv |
| run_settings.csv |