Hi all,
I’m looking for guidance on specifying mixed-effects models in Stata for a cross-classified longitudinal dataset with repeated measures.
Data structure:
Here are my questions:
Many thanks in advance for any guidance.
I’m looking for guidance on specifying mixed-effects models in Stata for a cross-classified longitudinal dataset with repeated measures.
Data structure:
- Repeated observations over continuous time (months_since_base)
- Individuals (newid) observed repeatedly
- Observations are also cross-classified within non-nested dyads/partnerships (newpartid)
- Individuals can appear in multiple dyads over time
- Dyads are not nested within individuals
- Both individuals and dyads have repeated measurements over time
Code:
mixed aes_mean_lag c.months_since_base || _all: R.newid || _all: R.newpartid
- Random slope for time
In mixed, does specifying a random slope for time require including a random intercept at that level (e.g., || newid: months_since_base, cov(unstructured)), or can time be specified alone as a random coefficient? - Appropriate level(s) for random slopes
In a cross-classified repeated-measures setting, is it reasonable to allow the time slope to vary at the individual level, the dyad level, or both? Are there recommended diagnostics or decision rules to guide this choice? - Model-building strategy
Any best-practice advice for building these models incrementally (random intercepts only → add random slopes → relax covariance structure), particularly for choosing between independent vs correlated intercept/slope terms?
Code:
clear input str12 partnership str5 id float(months_since_base aes_mean_lag) "ID001--ID006" "ID001" 0 . "ID001--ID006" "ID001" 1.68 1 "ID001--ID009" "ID001" 4.71 4 "ID006--ID001" "ID006" 0 . "ID006--ID001" "ID006" 2.1 3 "ID009--ID001" "ID009" 0 . "ID009--ID001" "ID009" 3.45 2 end
Many thanks in advance for any guidance.

Comment