How do you analyze longitudinal data?
Longitudinal data analysis examines repeated observations from the same units while accounting for their relationship over time. Start by checking the records, timing, measures and missing observations. Then choose an analysis that answers the question, whether it concerns average change, individual trajectories, transitions or the timing of events.
A matched change score is sometimes sufficient for a descriptive question. More complex questions may need a model that accounts for repeated observations, differences between units and other relevant factors. No method makes the data reliable merely because it contains a persistent identifier.
This guide provides a practical sequence, a worked example and an overview of method choices. For the underlying structure, see longitudinal data; for the collection plan, see longitudinal studies.
Define the question and the result you want to estimate
Be specific. “Did scores change?” could mean change among everyone with both observations, change in successive respondent averages or a model-based estimate for a defined population. These are different results.
State the outcome, unit, time interval and analysis population. Decide whether the question is descriptive, predictive or causal. A descriptive increase after an intervention does not automatically estimate the intervention's effect.
For example: “Among learners with valid entry and exit assessments, what was the average score change?” This is narrower and more interpretable than “How much impact did the program have?” The latter requires a design that supports attribution and consideration of other explanations.
Check the structure before calculating change
Verify that each observation belongs to the intended unit and time. A unit may be a person, organization or site. The observation key may also need a program, instrument or attempt identifier if several measurements occur in one period.
Inspect duplicate keys rather than deleting them blindly. Two records may be a corrected submission, separate assessments or an import duplication. Decide which rule applies and retain the correction history.
Check actual observation dates, scale versions and eligibility. A follow-up completed two weeks after entry may not be comparable to one completed six months later. A missing value, a valid zero and “not applicable” need different treatment.
Long format is often convenient for repeated-measures models; wide format can make simple paired calculations easy to inspect. Reshaping does not resolve ambiguous keys or create missing observations.
A worked example: matched change and changing coverage
The following small dataset is fictional and is intended to demonstrate arithmetic, not statistical inference. Scores use the same ten-point measure at entry and follow-up.
Scroll horizontally to see all columns →
| Unit | Entry | Follow-up | Change |
|---|---|---|---|
| P-01 | 4 | 7 | +3 |
| P-02 | 6 | 8 | +2 |
| P-03 | 8 | 7 | −1 |
| P-04 | 2 | Missing | Not observed |
For the three matched units, the changes sum to 4, so the mean change is 4 ÷ 3 = 1.33 points. Their entry mean is 6 and their follow-up mean is 7.33, giving the same difference.
The entry mean across all four units is 5. Comparing that with the follow-up mean of 7.33 gives a difference of 2.33 points. That is not the mean within-unit change: the lower-scoring P-04 is absent from follow-up. The example shows why the population behind each average matters.
A clear report would say: “Among three units with paired observations, the mean score increased by 1.33 points; one of four units lacked follow-up.” It would not assume P-04 improved, declined or stayed unchanged.
The mean also hides different trajectories: two scores increased and one decreased. Inspect the distribution of changes and individual patterns where access permits, instead of reporting only a favorable average.
Choose a method that fits the outcome and design
Scroll horizontally to see all columns →
| Question or structure | Possible approach | What needs attention |
|---|---|---|
| Describe change between two comparable observations | Paired changes, distributions and suitable uncertainty estimates | Matched population, scale properties and missing pairs |
| Several continuous measurements with differences between units | A suitable mixed-effects or growth model | Time specification, random-effects structure, model fit and assumptions |
| Repeated outcomes with a population-average association of interest | Generalized estimating equations where appropriate | Outcome family, correlation, number of clusters and missingness |
| Within-unit association while accounting for stable unit characteristics | A suitable unit fixed-effects approach | Time-varying confounding, limited within-unit variation and interpretation |
| Time until a defined event | Event-history or survival analysis | Event definition, censoring, entry time and model assumptions |
These are starting points, not interchangeable recipes. The official statsmodels documentation describes GEE for correlated or longitudinal observations and mixed-effects models for dependent data. Software can fit a model without making its assumptions appropriate for your study.
Choose the time scale deliberately. Time since enrollment, calendar time and wave number can represent different processes. Allowing a straight-line trend is a modeling choice, not a fact established by having three observations.
Use statistical expertise when the required method exceeds the team's experience. A transparent descriptive result can be more useful than a complex model whose interpretation nobody can explain.
Account for repeated observations and other clustering
Three observations from one participant are not three independent participants. Measurements within a unit may be related. Ignoring that dependence can produce misleading uncertainty estimates or tests.
There may also be shared context: learners within schools, clients within programs or organizations within regions. Determine which structure is relevant to the analysis rather than assuming a participant identifier accounts for every source of dependence.
Comparing a unit with itself can help address stable differences under an appropriate design or model. It does not automatically remove all confounding. Time-varying circumstances, measurement changes, regression to the mean and other influences may remain.
Describe the model's target clearly. A population-average association and a unit-specific modeled association are not necessarily the same quantity, particularly for some non-continuous outcomes.
Treat missing observations as an analytical issue
Start by reporting coverage at each wave and for the comparisons used. Distinguish an intermittent missed wave from permanent loss where known, and separate ineligibility from nonresponse or processing failure.
Compare available information for retained and missing units. A difference may indicate selective loss, but observed characteristics cannot fully reveal the unobserved outcomes. Do not conclude that missingness is harmless simply because one comparison is not statistically significant.
Complete-case analysis, weighting, imputation and model-based approaches each require assumptions and suitable implementation. Some likelihood-based analyses can use incomplete repeated observations under stated conditions; they do not make all missing-data mechanisms ignorable.
Do not automatically carry the last value forward or replace missing values with the group mean. Such substitutions can distort trajectories and uncertainty. Where conclusions depend on missing-data assumptions, examine plausible alternatives and explain the sensitivity.
Add qualitative context without claiming a guaranteed explanation
Comments, notes or interviews may clarify experiences behind a trajectory. The connection should fit the collection design. A person's own account can be relevant to their observed change, while a separate interview sample may explain broader patterns at group level.
Retain contradictory accounts and avoid treating every comment as the verified cause of a score movement. Someone may report a barrier that did not determine the measured outcome, or describe an experience from a different period.
AI can help locate passages and organize themes, but the interpretation needs review. Keep source context and relevant coding decisions available to authorized reviewers. Do not require open-ended explanations in every study merely to make a result appear more complete.
For integrating the strands explicitly, see mixed-methods data analysis.
Check robustness and report what the result means
Review whether the conclusion changes with reasonable choices about the analysis window, sample, measure version or handling of incomplete observations. Inspect influential records and data errors without removing inconvenient results merely to improve the finding.
Separate effect size, uncertainty and practical importance. A statistically detectable difference may be small in practice; an important difference may be estimated imprecisely. Explain the scale and the decision context rather than relying on a p-value alone.
A useful report includes the study population, observation schedule, coverage, measures, linkage checks, method, assumptions and limitations. State whether the result describes matched participants, a modeled population or another defined group.
Keep the source version, calculation or analysis code, filters and review decisions. A reader should be able to understand how the reported result was produced. Reproducible calculations support checking; they do not by themselves establish that the study answers the intended question.
Make recurring analysis manageable
For organizations collecting over time, much of the work lies in maintaining definitions, records and permissions. Local teams can use different instruments while sharing a limited core for agreed comparisons. Record which fields are comparable and which require separate interpretation.
Sopact's relevant role is connecting recurring collection, analysis and governance so operational teams can inspect evidence with its context. Test a later wave, a corrected record, a changed question and a missing follow-up. Confirm which analyses are native and which require export to specialist statistical software.
Do not assume that a persistent ID guarantees correct linkage, that AI explains every change or that a dashboard proves impact. The practical advantage should be less avoidable preparation and clearer review, demonstrated on the team's actual workflow.
For presenting findings, use the impact report guide and report examples.
Watch: connected observations across waves
This companion video introduces repeated evidence and connected records. The analytical checks above remain necessary before interpreting change.
Frequently asked questions
What is the first step in longitudinal analysis?
Define the question and analysis population, then verify that observations belong to the right units, times and measures. Check missing data and duplicate keys before calculating change.
Can I subtract the first-wave mean from the last-wave mean?
You can describe that difference, but it is not necessarily average within-unit change if the respondent groups differ. A paired analysis uses the same units, and its population and missingness should be stated.
Which model is best for longitudinal data?
There is no universal best model. The outcome type, time structure, target question, clustering and missing-data assumptions determine the suitable approach.
Does comparing people with themselves eliminate confounding?
No. Suitable within-unit approaches can account for some stable differences, but time-varying influences, measurement changes and other explanations may remain.
Must I exclude every unit with a missing wave?
Not necessarily. Some methods use incomplete observations under stated assumptions. Choose and justify the approach rather than automatically deleting records or filling gaps.
Can qualitative comments prove why a score changed?
They can add valuable context or a participant's explanation, but they do not automatically establish cause. Check timing, source context, conflicting evidence and the study design.

