Why Repeated Measurements Need Their Own Model
A donor may contribute measurements at several visits, or under several conditions. Those measurements are not independent replicates: observations from one donor share biological characteristics, sampling history, and often technical features. A model that treats every sample as independent can therefore understate uncertainty and give donors with more observations disproportionate influence.
The goal of a repeated-measures model is to represent both the average relationship of interest and the dependence among measurements from the same donor. For cell-type proportions, the outcome may be a proportion-scale value, a model for counts, or a log-ratio coordinate. The repeated-measures structure is the part that accounts for the common donor; it does not replace the choice of a suitable outcome model.
For a proportion \(p_{ijk}\), let \(i\) index donors, \(j\) index observations or visits within donor, and \(k\) index cell types. One possible outcome for cell type \(k\) is the log-ratio coordinate \(z_{ijk}=\log(p_{ijk}/p_{ijr})\), where \(r\) is a chosen reference cell type. Alternatively, for a single cell type versus all other cells, the outcome can be modeled through its log odds. These choices concern the composition and outcome scale; the repeated-measures structure concerns dependence across \(j\) for the same \(i\).
Random-Effects Models for Donor Dependence
A basic repeated-measures model for a continuous log-ratio coordinate is a random-intercept model. For two conditions and a continuous time variable, one specification is
Here, \(C_{ij}\) is an indicator for the condition of interest, \(t_{ij}\) is time measured in stated units, \(b_i\) is the donor-specific random intercept, and \(\epsilon_{ij}\) is the observation-level residual. A conventional model assumes \(b_i\sim N(0,\tau^2)\), that residuals have mean zero and variance \(\sigma^2\), and that donors are independent. In the simplest form, residuals are independent across observations conditional on the random effects, and \(b_i\) is independent of the residuals and the modeled covariates. Those assumptions imply a common within-donor correlation for distinct observations under the random-intercept-only model.
The coefficient \(\beta_C\) is the modeled condition difference when \(t=0\). The coefficient \(\beta_T\) is the time trend in the reference condition \(C=0\). The interaction \(\beta_{CT}\) is the difference in time trends between conditions. Thus, the condition difference at time \(t\) is \(\beta_C+\beta_{CT}t\). Choosing a meaningful time origin, such as baseline, makes the main-effect interpretation useful.
If donors may differ in their time trends, a random slope can be added, for example \(b_{0i}+b_{1i}t_{ij}\). This allows both donor-specific starting levels and donor-specific trajectories. It requires enough donors and repeated observations to estimate the additional variation; a complicated random-effects structure is not automatically better.
For counts, a corresponding generalized linear mixed model can use the cell-type count \(Y_{ij}\) out of \(N_{ij}\) cells, with a binomial likelihood and a logit link:
This model represents donor dependence through \(b_i\), while the binomial sampling model represents the count out of the observed total. Its conditional effects are on the log-odds scale. The cell count is not a substitute for the number of independent donors: additional cells can improve a donor’s proportion estimate, but they do not create additional independent biological replicates.
What the Correlation Structure Implies
In the random-intercept model, the donor intercept adds shared variation to every observation from the same donor. For two distinct observations \(j\) and \(j'\) from donor \(i\),
The quantity \(\rho\) is the intraclass correlation coefficient under this model. It is the correlation between two observations from the same donor, assuming the same residual variance and no additional within-donor correlation pattern. A positive \(\rho\) means that repeated observations contain overlapping information.
A short derivation shows why ignoring this overlap can inflate apparent precision. Suppose each of \(D\) independent donors has \(m\) measurements with common marginal variance \(v\) and common within-donor correlation \(\rho\). The variance of the grand mean is the sum of all variances and covariances divided by \((Dm)^2\):
If the \(Dm\) measurements were incorrectly treated as independent, the variance would be estimated as \(v/(Dm)\), omitting the factor \(1+(m-1)\rho\). This factor is the design effect for this balanced, equal-correlation setting. The calculation does not establish that every data set has this exact correlation structure; it explains why a plausible positive within-donor correlation matters.
Worked Example: A Within-Donor Condition Contrast
Suppose six hypothetical donors each have a log-ratio measurement for a cell type versus a reference type under control and treatment. The treatment-minus-control differences, in log-ratio units, are \(-0.20,-0.10,0.00,0.10,0.20,0.30\). A paired analysis is equivalent to estimating the treatment effect from these within-donor differences in this simple two-condition design.
The mean difference is
The deviations from \(0.0500\) are \(-0.25,-0.15,-0.05,0.05,0.15,0.25\). Their squared sum is \(0.175\), so the sample standard deviation of differences is
The paired \(t\) statistic for \(H_0:\mu_d=0\) is \(t=0.0500/0.0764=0.654\), with \(df=5\). This small hypothetical sample does not provide strong evidence against no average within-donor condition difference. The estimate is \(0.0500\) log-ratio units; exponentiating it gives \(\exp(0.0500)=1.051\), a 5.13% increase in the cell-type-to-reference ratio on this estimated scale. This contrast removes any donor-specific additive level that is shared across the two conditions, but it does not by itself address more than two visits or changing effects over time.
Interpreting Condition and Time Together
With an interaction, a single condition coefficient does not describe the condition difference at every time. The model’s fitted difference must be evaluated at the time of interest. This is especially important when time is centered or when baseline is not coded as zero. On a log-ratio scale, exponentiating a contrast gives a ratio of cell-type-to-reference ratios, not a direct percentage-point change in the cell-type proportion.
Worked Example: A Condition-by-Time Effect
Consider a hypothetical fitted model for a cell type’s log-ratio coordinate, with time in months and \(t=0\) at baseline. Suppose the estimated coefficients are \(\hat\beta_0=-1.20\), \(\hat\beta_C=-0.15\), \(\hat\beta_T=0.04\), and \(\hat\beta_{CT}=0.08\), all in log-ratio units per the relevant term.
At baseline, the estimated treatment-minus-control contrast is \(\hat\beta_C=-0.15\). At six months, it is
Thus, at six months the fitted treatment-to-control ratio of cell-type-to-reference ratios is \(\exp(0.33)=1.391\), or about 39.1% higher on that ratio-of-ratios scale. The estimated time trend in the control condition is \(0.04\) log-ratio units per month; in treatment it is \(0.04+0.08=0.12\) per month. These are model-based associations. They do not establish that treatment caused a composition change, and the coefficient values alone do not show whether either contrast is statistically distinguishable from zero.
The same logic applies to a model with categorical visits: specify the reference visit and condition, then form the relevant linear contrast of coefficients. A condition main effect in an interaction model is conditional on the chosen reference time, not a universal average treatment effect.
Worked Example: The Cost of Ignoring Clustering
Worked Example: Adjusting the Standard-Error Intuition
Suppose a hypothetical study has 12 donors, each measured at three visits. For illustration, assume an equal marginal variance and an intraclass correlation of \(\rho=0.60\). If an independence-based analysis reports an SE of \(0.0800\) for a grand mean, the balanced-cluster design-effect calculation gives
The approximate standard error is therefore about \(0.119\), not \(0.0800\), under these simplifying assumptions. This is an illustration of the effect of dependence, not a substitute for fitting the chosen model. In particular, actual visit patterns, unequal variances, covariate adjustment, and estimation of the correlation can change the result.
Choosing and Checking a Repeated-Measures Approach
A paired analysis is often suitable for a single before-and-after contrast when every donor contributes both measurements and the target is the average within-donor difference. A mixed model generalizes this approach to multiple visits, incomplete repeated observations under appropriate assumptions, and covariates that vary across observations. A marginal model, such as generalized estimating equations, instead specifies a working within-donor correlation and targets a population-average relationship; robust standard errors can protect inference against some correlation misspecification when there are enough independent donors. Neither approach makes the donor clusters disappear.
An independence-based regression is defensible only when observations are genuinely independent at the modeled unit, or when dependence is otherwise correctly represented. Treating repeated samples as independent is not repaired by having many cells per sample. Likewise, choosing a more elaborate random-effects model does not guarantee valid inference if there are very few donors or if the outcome model is badly specified.
Useful checks include plotting each donor’s trajectory, looking for systematic differences in spread across visits or conditions, and checking whether the fitted model leaves residual patterns within donors. A random-intercept model implies a particular dependence pattern; strong serial correlation that changes with the time gap may call for an explicit residual correlation structure. A random-slope model may be considered when donor trajectories vary, but singular fits or near-zero estimated random-effect variances warn that the data may not support the added complexity.
- Too few donors: many observations per donor do not provide many independent clusters. Small-cluster inference can be unreliable, and large-sample standard-error approximations may be poor.
- Incorrect time form: a linear time effect can miss curvature or abrupt changes. Inspect trajectories and choose time coding that reflects the visit schedule and scientific question.
- Unmodeled dependence: residual correlation remaining within donors suggests the assumed covariance structure is inadequate.
- Proportion-scale problems: an untransformed linear model can predict outside zero to one and may not respect compositional constraints. Choose an outcome scale or count likelihood appropriate to the data and question.
- Unequal observation counts: donors with more visits can contribute more information, but this does not justify treating their observations as independent or automatically as more independent donors.
Repeated-measures models matter because they separate the average condition or time pattern from donor-to-donor heterogeneity. Their conclusions depend on the chosen outcome scale, fixed-effect coding, covariance assumptions, and number of independent donors. Report the scale of each effect, the repeated-measures structure, and the number of donors so that the estimate and its uncertainty can be interpreted in context.
Check Your Understanding
Answer each question, then compare with the solutions.
- A random-intercept model has \(\tau^2=0.30\) and \(\sigma^2=0.70\). What is its implied within-donor correlation?
- In a model with condition, time, and their interaction, what is the condition contrast at time \(t=4\)?
- For four visits per donor and intraclass correlation \(0.25\), calculate the balanced-cluster design effect.
- Why does increasing the number of cells sequenced from each donor not have the same effect on independent replication as recruiting more donors?
Solutions. 1. \(\rho=0.30/(0.30+0.70)=0.30\). 2. The contrast is \(\beta_C+4\beta_{CT}\); its estimate is \(\hat\beta_C+4\hat\beta_{CT}\). 3. \(1+(4-1)(0.25)=1.75\). 4. More cells may improve the precision of a donor’s measured composition, but cells from that donor do not supply independent donor-level information; additional donors add independent clusters.