Daily diary and intensive longitudinal studies repeatedly measure changing experiences in everyday life. Their main advantage is the ability to study within-person processes: for example, whether a student reports more negative affect than usual on days when stress is higher than that student’s own average.
This workflow distinguishes those questions from between-person comparisons. It audits the person-by-day structure, separates within-person and between-person effects, respects calendar gaps when constructing lags, evaluates random slopes and serial dependence, and treats temporal ordering as evidence about sequence rather than proof of causation.
After completing the example, the user should be able to:
The example uses daily observations. Multiple prompts per day, irregular continuous time, categorical outcomes, location or sensor streams, dynamic structural equation models, multilevel vector autoregression, and latent state-space models require extensions.
| Feature | Ordinary repeated measures or growth model | Daily diary or intensive longitudinal model |
|---|---|---|
| Typical occasions | A small number of planned waves | Many closely spaced observations |
| Primary focus | Mean change and individual growth | Short-term within-person processes and carryover |
| Timing | Often common across participants | Completion times and gaps may differ |
| Dependence | Random effects often central | Random effects plus serial dependence may matter |
| Missingness | Missing waves | Unequal compliance, bursts, missed days, delayed responses |
| Predictors | Often time invariant or wave specific | Frequently time varying and person-mean centered |
| check | result |
|---|---|
| Scheduled person-days | 2520 |
| Completed person-days | 2001 |
| Unique participants scheduled | 180 |
| Unique participants observed | 180 |
| Duplicate observed person-days | 0 |
| Records out of date order | 0 |
The analysis requires one record per participant per intended day. Resolve duplicate dates from source metadata rather than silently retaining the first row. Sort by participant and actual date before constructing lags.
| participants | mean_days | median_days | minimum_days | maximum_days | below_threshold | mean_compliance |
|---|---|---|---|---|---|---|
| 180 | 11.117 | 11 | 3 | 14 | 1 | 0.794 |
A threshold is a planning and sensitivity decision, not a universal exclusion rule. Mixed models can use unequal numbers of observations, but participants with very few records contribute little information about within-person associations and random slopes.
| variable | between_person_sd | median_within_person_sd | people_with_zero_or_undefined_variance | people_observed |
|---|---|---|---|---|
| stress | 0.853 | 0.685 | 0 | 180 |
| sleep | 0.500 | 0.622 | 0 | 180 |
| coping | 0.540 | 0.622 | 0 | 180 |
| positive_affect | 0.435 | 0.674 | 0 | 180 |
| negative_affect | 1.038 | 0.672 | 3 | 180 |
A within-person predictor needs within-person variation. A variable can vary greatly across people while remaining nearly constant within each person. Inspect the number of people with zero or undefined personal variance before fitting person-specific slopes.
| stress_wp | sleep_wp | coping_wp |
|---|---|---|
| 0 | 0 | 0 |
The within-person stress term asks whether affect changes on days when a participant reports more stress than their own observed average. The between-person stress term asks whether participants with higher average stress differ from participants with lower average stress. These are different estimands and can have different magnitudes or directions.
Grand-mean centering a time-varying predictor does not create this separation. Person means should be interpreted cautiously when compliance is low or the diary window poorly represents a person’s usual experience.
| between_person_variance | within_person_variance | ICC |
|---|---|---|
| 1.028 | 0.482 | 0.681 |
The ICC describes the proportion of unconditional outcome variance attributable to stable differences between participants during this study window. It does not indicate the reliability of an individual diary entry and does not determine whether a multilevel model is needed by itself.
| effect | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|---|
| fixed | (Intercept) | 1.905 | 1.115 | 1.709 | 177.778 | 0.089 | -0.295 | 4.106 |
| fixed | stress_wp | 0.422 | 0.024 | 17.846 | 214.219 | 0.000 | 0.375 | 0.468 |
| fixed | stress_pm | 0.644 | 0.086 | 7.455 | 178.895 | 0.000 | 0.474 | 0.815 |
| fixed | sleep_wp | -0.201 | 0.022 | -9.334 | 1803.797 | 0.000 | -0.243 | -0.159 |
| fixed | sleep_pm | -0.131 | 0.132 | -0.990 | 177.356 | 0.324 | -0.391 | 0.130 |
| fixed | coping_wp | -0.159 | 0.021 | -7.633 | 1794.265 | 0.000 | -0.200 | -0.118 |
| fixed | coping_pm | -0.115 | 0.136 | -0.848 | 177.977 | 0.397 | -0.383 | 0.153 |
| fixed | day_c | -0.033 | 0.003 | -9.474 | 1812.397 | 0.000 | -0.040 | -0.026 |
| fixed | weekend | -0.046 | 0.031 | -1.491 | 1812.461 | 0.136 | -0.108 | 0.015 |
| effect | group | term | estimate | conf.low | conf.high |
|---|---|---|---|---|---|
| ran_pars | participant_id | sd__(Intercept) | 0.854 | NA | NA |
| ran_pars | participant_id | cor__(Intercept).stress_wp | 0.323 | NA | NA |
| ran_pars | participant_id | sd__stress_wp | 0.157 | NA | NA |
| ran_pars | Residual | sd__Observation | 0.556 | NA | NA |
| converged | singular | observations | participants |
|---|---|---|---|
| TRUE | FALSE | 2001 | 180 |
The random stress slope allows the within-person stress association to differ across participants. A small estimated slope variance can reflect true similarity, inadequate occasions, limited within-person variation, or weak information in a 14-day design. Do not remove the slope solely to obtain a simpler-looking table.
| observed_records | records_with_previous_observation | records_with_valid_consecutive_day_lag |
|---|---|---|
| 2001 | 1821 | 1505 |
| effect | term | estimate | std.error | statistic | df | p.value | conf.low | conf.high |
|---|---|---|---|---|---|---|---|---|
| fixed | (Intercept) | 1.316 | 0.726 | 1.814 | 75.672 | 0.074 | -0.129 | 2.762 |
| fixed | lag1_stress_wp | 0.142 | 0.028 | 4.977 | 1336.534 | 0.000 | 0.086 | 0.197 |
| fixed | lag1_sleep_wp | -0.087 | 0.028 | -3.057 | 1212.782 | 0.002 | -0.142 | -0.031 |
| fixed | lag1_coping_wp | -0.041 | 0.027 | -1.503 | 1186.103 | 0.133 | -0.094 | 0.012 |
| fixed | lag1_negative_affect | 0.346 | 0.026 | 13.506 | 862.961 | 0.000 | 0.296 | 0.396 |
| fixed | stress_pm | 0.442 | 0.059 | 7.515 | 86.825 | 0.000 | 0.325 | 0.558 |
| fixed | sleep_pm | -0.108 | 0.086 | -1.260 | 75.043 | 0.211 | -0.280 | 0.063 |
| fixed | coping_pm | -0.068 | 0.088 | -0.773 | 75.805 | 0.442 | -0.244 | 0.108 |
| fixed | day_c | -0.023 | 0.005 | -4.782 | 1242.917 | 0.000 | -0.033 | -0.014 |
| fixed | weekend | -0.146 | 0.039 | -3.732 | 1199.049 | 0.000 | -0.222 | -0.069 |
The lag helper assigns a prior-day value only when two observed entries are exactly one calendar day apart. Carrying Friday’s value into Monday and calling it a one-day lag would change the estimand. The lagged model predicts current negative affect from the preceding observed calendar day while adjusting for prior negative affect and stable person means.
| term | npar | AIC | BIC | logLik | minus2logL | statistic | df | p.value |
|---|---|---|---|---|---|---|---|---|
| model_concurrent | 13 | 4001.731 | 4074.549 | -1987.866 | 3975.731 | NA | NA | NA |
| model_weekday | 18 | 4009.297 | 4110.122 | -1986.648 | 3973.297 | 2.434 | 5 | 0.786 |
The day trend captures gradual change across the study window. Weekday indicators capture recurring calendar patterns. Neither adjustment replaces substantive modeling of events such as deadlines, holidays, or intervention exposure.
| model | call | Model | df | AIC | BIC | logLik | Test | L.Ratio | p-value |
|---|---|---|---|---|---|---|---|---|---|
| model_lme_independent | lme.formula(fixed = negative_affect ~ stress_wp + stress_pm + sleep_wp + sleep_pm + coping_wp + coping_pm + day_c + weekend, data = ar_data, random = ~1 | participant_id, method = “ML”, na.action = na.omit, control = lmeControl(opt = “optim”)) | 1 | 11 | 4015.517 | 4077.133 | -1996.759 | NA | NA | |
| model_lme_ar1 | lme.formula(fixed = negative_affect ~ stress_wp + stress_pm + sleep_wp + sleep_pm + coping_wp + coping_pm + day_c + weekend, data = ar_data, random = ~1 | participant_id, correlation = corCAR1(value = 0.2, form = ~day | participant_id), method = “ML”, na.action = na.omit, control = lmeControl(opt = “optim”, maxIter = 200, msMaxIter = 200)) | 2 | 12 | 3954.129 | 4021.346 | -1965.065 | 1 vs 2 | 63.388 | 0 |
The continuous-time AR(1) structure uses the actual day gaps and lets residual correlation decay across longer intervals. It is a sensitivity model here because the random-slope model and autocorrelation model use different random-effect structures. Studies with timestamps inside each day should use the actual observation times and may need a model designed for irregular continuous time.
Residual plots can reveal nonlinearity, unequal variance, heavy tails, and influential observations. They do not establish that the model is correctly specified. Also inspect participants with unusual trajectories and conduct sensitivity analyses that are justified by the measurement scale and design.
Faceted trajectories show heterogeneity, bursts, gaps, and possible reactivity that aggregate curves can hide. The selected participants are illustrative and must not replace a systematic influence review.
| simulations | estimated_power | mean_estimate | monte_carlo_se |
|---|---|---|---|
| 50 | 0.64 | 0.115 | 0.068 |
Power depends jointly on participants, usable occasions per participant, compliance, within-person predictor variance, outcome reliability, random-effect variation, serial dependence, and the estimand. The small simulation above is a reproducible demonstration, not a study-specific power analysis. A defensible plan should simulate the intended model using plausible parameters, missingness, timing, and decision rules, then repeat enough times to make Monte Carlo error acceptably small.
Adding participants generally improves between-person estimates and stabilizes random effects. Adding occasions can improve within-person estimates, but only when participants complete them and the added days capture meaningful variation. A long protocol with poor adherence can be less informative than a shorter, well-designed protocol.
Across 180 participants, 2001 of 2520 scheduled person-days were completed (79.4%). Participants completed a median of 11 days (range 3-14). The unconditional ICC for negative affect was 0.681, indicating that 68.1% of its unconditional variance was between participants during the diary window. In the concurrent random-slope model, a one-unit increase in stress relative to a participant’s own mean was associated with a 0.422-unit change in same-day negative affect (SE = 0.024, p < .001). The between-person stress association was 0.644 (p < .001), demonstrating why the two levels should not be combined. In the calendar-aware lagged model, prior-day stress relative to the participant’s mean was associated with a 0.142-unit change in current negative affect after adjustment for prior negative affect and the other listed covariates (p < .001). The continuous-time AR(1) sensitivity model estimated a residual correlation of 0.241 across a one-day interval. These temporal associations do not establish a causal effect of stress because time-varying confounding, measurement timing, carryover, and selective completion remain possible.
Use a different or extended model when the outcome distribution is not approximately continuous and Gaussian, observation timing is highly irregular, multiple processes influence each other dynamically, measurement error is central, intensive observations are nested in couples or teams, carryover varies nonlinearly over continuous time, or the research question concerns latent states and transitions. Consider generalized mixed models, location-scale models, continuous-time models, multilevel vector autoregression, dynamic structural equation models, state-space models, or latent transition analysis as appropriate.
External validation and replication remain essential. A 14-day window can describe processes in that period; it does not guarantee that the same within-person association holds in another semester, clinical phase, institution, or population.