Purpose

This workflow introduces growth modeling as a multilevel analysis of repeated observations nested within people. It moves from an unconditional means model to linear change and a conditional model, while keeping the time metric, random effects, missing observations, diagnostics, and interpretation visible.

The included longitudinal data are entirely synthetic. The repeated observations are not independent. Run the example before adapting it, and define what time zero and a one-unit change in time mean for your study.

Questions a growth model can answer

  • What is the expected outcome at the chosen time origin?
  • What is the average rate of change?
  • How much do people differ in initial status and change?
  • Do person-level or time-varying predictors explain those differences?
  • Is linear change adequate over the observed period?

User settings

Simulate and import the example

Rows: 1,100
Columns: 7
$ student_id           <chr> "D001", "D001", "D001", "D001", "D001", "D002", "~
$ month                <dbl> 0, 3, 6, 9, 12, 0, 3, 6, 9, 12, 0, 3, 6, 9, 12, 0~
$ time                 <dbl> 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1~
$ score                <dbl> 64.9, 69.5, 71.1, 76.9, 80.5, NA, 52.8, 59.7, 65.~
$ mentoring            <fct> Standard, Standard, Standard, Standard, Standard,~
$ first_generation     <fct> No, No, No, No, No, Yes, Yes, Yes, Yes, Yes, Yes,~
$ baseline_preparation <dbl> 0.69, 0.69, 0.69, 0.69, 0.69, 0.44, 0.44, 0.44, 0~

Data structure and audit

Analysis flow

people records observed_scores missing_scores minimum_waves maximum_waves
220 1100 1045 55 5 5
stage n
Imported records 1100
Common complete-case model sample 1045
Excluded for missing model values 55

Observed trajectories

Unconditional means model

term estimate std_error df t_value p_value conf_low conf_high
(Intercept) 57.993 0.541 825 107.157 0 56.931 59.055

The intraclass correlation is 0.64, meaning that approximately 63.7% of the outcome variance is between students before time or predictors are included. This clustering is why an ordinary regression that treats every row as independent is inappropriate.

Linear growth model

term estimate std_error df t_value p_value conf_low conf_high
(Intercept) 52.342 0.544 824 96.241 0 51.275 53.410
time 2.857 0.091 824 31.459 0 2.679 3.035
student_id = pdLogChol(time) 
            Variance   StdDev    Corr  
(Intercept) 58.2447980 7.6318280 (Intr)
time         0.6707341 0.8189836 0.043 
Residual    10.5405520 3.2466216       

Because time is coded 0 at baseline and one unit equals 3 months, the intercept is the expected baseline score and the time coefficient is the expected 3-month change. Random-intercept and random-slope variances describe heterogeneity; they are not measurement error.

Fitted trajectories

Conditional growth model

term estimate std_error df t_value p_value conf_low conf_high
(Intercept) 52.618 0.733 823 71.747 0.000 51.179 54.058
time 2.436 0.122 823 20.042 0.000 2.198 2.675
mentoringEnhanced 1.814 0.928 216 1.956 0.052 -0.014 3.643
baseline_preparation 4.460 0.458 216 9.732 0.000 3.556 5.363
first_generationYes -1.476 0.907 216 -1.627 0.105 -3.263 0.312
time:mentoringEnhanced 0.849 0.172 823 4.926 0.000 0.510 1.187

The mentoring main effect compares groups at baseline. The time-by-mentoring interaction compares their rates of change. Baseline preparation and first-generation status are time-invariant covariates in this example.

Predicted group trajectories

Model comparison

model call Model df AIC BIC logLik Test L.Ratio p-value
means_model lme.formula(fixed = score ~ 1, data = analysis_data, random = ~1 | student_id, method = “ML”, na.action = na.fail) 1 3 7104.551 7119.406 -3549.275 NA NA
growth_model lme.formula(fixed = score ~ time, data = analysis_data, random = ~time | student_id, method = “ML”, na.action = na.fail, control = lmeControl(opt = “optim”)) 2 6 6274.841 6304.552 -3131.421 1 vs 2 835.710 0
conditional_model lme.formula(fixed = score ~ time * mentoring + baseline_preparation + first_generation, data = analysis_data, random = ~time | student_id, method = “ML”, na.action = na.fail, control = lmeControl(opt = “optim”)) 3 10 6175.653 6225.171 -3077.826 2 vs 3 107.188 0

Likelihood-ratio comparisons require models fitted with maximum likelihood when their fixed effects differ. Prefer a model because it answers the prespecified question and fits adequately, not solely because it has the smallest information criterion.

Diagnostics

Residuals

Random effects

Also review the functional form of time, covariance structure, level-specific residuals, influential people, missing-data assumptions, and whether the number and timing of measurements support the proposed random effects.

Dynamic results template

A linear mixed-effects model was fitted to 1045 observations from 220 students. Time was centered at baseline and scaled so one unit represented 3 months. The estimated baseline score was 52.34, 95% CI [51.27, 53.41]. Scores changed by an average of 2.86 points per 3 months, 95% CI [2.68, 3.04], p < .001.

In the conditional model, the enhanced-mentoring group changed 0.85 points more per 3 months than the standard group, 95% CI [0.51, 1.19], p < .001. Random intercepts and slopes allowed students to differ in baseline status and change. Interpret the interaction with the predicted trajectories and in light of the observational or experimental design.

Reporting checklist

  • State the nesting structure, waves, timing, and analysis sample.
  • Define time zero and the unit of the time coefficient.
  • Describe fixed effects, random effects, covariance structure, and estimation method.
  • Report missing-data handling and assumptions.
  • Present predicted trajectories with uncertainty when possible.
  • Document residual, functional-form, covariance, and influence checks.

Exports

file
synthetic_growth_data.csv
linear_growth_fixed_effects.csv
conditional_growth_fixed_effects.csv
student_random_effects.csv
model_comparison.csv
predicted_group_trajectories.csv
analysis_flow.csv
run_settings.csv

References

  • Hoffman, L. (2015). Longitudinal Analysis: Modeling Within-Person Fluctuation and Change. Routledge.
  • Singer, J. D., & Willett, J. B. (2003). Applied Longitudinal Data Analysis. Oxford University Press.