Tutorials › Regression Analysis (Undergraduate) › Repeated Measurements and Serial Dependence

Grouped Data and Dependence Awareness · Tutorial 885 of 991

Repeated Measurements and Serial Dependence

Learn to recognize time-related dependence within people, calculate its effect in a simple example, and distinguish person-clustered uncertainty estimates from models that describe longitudinal correlation.

Advanced 10 min read

What You'll Learn

  • Identify the person and time indices in repeated-measurement regression data
  • Distinguish serial dependence from a model that assumes independent observations
  • Derive how serial correlation changes the variance of a repeated-measurement average
  • Explain what person-clustered standard errors allow within each person
  • Compare clustered uncertainty estimation with explicitly modeling a longitudinal correlation pattern

Why Repeated Measurements Need Special Attention

A data set can contain many rows without containing that many independent sources of information. If each person is measured at several visits, one row may describe that person's outcome today and another row the same person's outcome next month. A person's health, habits, and circumstances tend to persist, so outcomes close together in time can be more alike than outcomes from different people.

This dependence matters for regression inference. A regression mean model can describe how an outcome relates to predictors while its usual standard-error calculation still treats all rows as independent. If repeated outcomes from one person are correlated, that calculation can understate uncertainty. The key is to distinguish the mean relationship being estimated from the dependence among observations used to quantify its uncertainty.

Definition: In repeated-measurement data, let \(i\) index people and \(t\) index measurement occasions. Serial dependence occurs when outcomes or regression errors from the same person at different occasions are correlated. A common pattern is stronger dependence between nearby occasions than between occasions far apart. The person is the independent cluster when different people are independent of one another.

A basic repeated-measurement regression can be written as \(Y_{it} = \beta_0 + \beta_1 x_{it} + \epsilon_{it}\), where \(Y_{it}\) is the outcome for person \(i\) at time \(t\), \(x_{it}\) is a predictor, and \(\epsilon_{it}\) is the error around the specified mean. This equation does not itself require errors from the same person to be independent. The usual independent-observation standard-error calculation does require that kind of independence, however, and therefore may not suit repeated measurements.

For the discussion below, suppose the mean relationship is correctly specified, predictor information is adequate for estimating its coefficients, and different people are independent. Within a person, errors may be correlated across occasions. These are substantive assumptions: clustering standard errors by person does not make an incorrect mean model correct, nor does it remove dependence between different people.

Recognizing the Time Pattern

The index \(t\) carries more information than a generic row number. It can indicate visit order, calendar time, or time since enrollment. If one person is measured on consecutive days, dependence may be strongest between measurements a day apart and weaker between those several weeks apart. That pattern is called serial because it follows an ordered sequence.

A simple way to describe this idea is to imagine that errors have the same variance \(\sigma^2\) at each occasion and correlation \(\rho\) between adjacent occasions. Under a first-order autoregressive pattern, the correlation \(k\) occasions apart is \(\rho^k\), with \(|\rho|<1\). This is one possible pattern, not a default truth: real data may have a different time structure, and a person-clustered standard error does not require choosing this particular pattern.

Worked Example: Finding the Independent Unit

Suppose a hypothetical clinic records blood pressure for each of 60 people at baseline and at three follow-up visits. The analysis uses 240 rows. The question is whether a treatment indicator is associated with follow-up blood pressure, after accounting for baseline blood pressure.

Identify the structure. There are 60 people, each with up to four outcome records. The 240 rows are not automatically 240 independent observations: measurements from one person may share stable characteristics and may also be serially related over time.

Identify a sensible clustering unit. If different people can reasonably be treated as independent, the person is the independent cluster. All four rows for a person belong to that same cluster, even though they correspond to different visits.

State the implication. Treating all 240 rows as independent could produce a standard error that is too small if within-person errors are positively correlated. The treatment coefficient's meaning still comes from the specified regression mean; recognizing the person clusters changes the uncertainty calculation, not the coefficient's definition.

How Serial Correlation Changes a Simple Variance

A short derivation shows why repeated observations need not contribute as much information as the same number of independent observations. Consider the average of \(T\) errors from one person. Assume each error has mean zero and variance \(\sigma^2\), and assume the first-order autoregressive correlation pattern \(\operatorname{Corr}(\epsilon_{it},\epsilon_{is})=\rho^{|t-s|}\). The variance of a sum is the sum of all variances and covariances. Each pair of occasions \(k\) steps apart contributes covariance \(\sigma^2\rho^k\), and there are \(T-k\) such pairs.

$$ \operatorname{Var}\left(\frac{1}{T}\sum_{t=1}^{T}\epsilon_{it}\right) = \frac{\sigma^2}{T^2} \left[ T+2\sum_{k=1}^{T-1}(T-k)\rho^k \right] $$

The factor of 2 appears because each covariance between two different occasions appears twice in the variance expansion: once for each ordering of the pair. If the errors are independent across occasions, then \(\rho=0\), all covariance terms vanish, and the variance is \(\sigma^2/T\). With positive serial correlation, the covariance terms are positive, so the variance of the average is larger than \(\sigma^2/T\).

Worked Example: Three Measurements With Positive Serial Correlation

Imagine three hypothetical measurements on one person. Suppose each error has variance \(\sigma^2\), and the correlation between adjacent errors is \(\rho=0.60\), with the correlation two occasions apart equal to \(\rho^2=0.36\). Compare the variance of their average with the variance under independence.

For \(T=3\), the general formula gives:

$$ \operatorname{Var}(\bar{\epsilon}_i) = \frac{\sigma^2}{3^2} \left[3+2\{(3-1)\rho+(3-2)\rho^2\}\right] $$

Substituting the specified correlations:

$$ \operatorname{Var}(\bar{\epsilon}_i) = \frac{\sigma^2}{9}\left[3+2\{2(0.60)+1(0.36)\}\right] = \frac{6.12}{9}\sigma^2 = 0.680\sigma^2 $$

Under independence, the variance would be \(\sigma^2/3=0.333\sigma^2\). Thus the variance with this positive serial dependence is \(0.680/0.333=2.04\) times as large. This calculation is about the variance of one person's three-measurement average under the stated correlation assumptions; it is not a universal correction factor for every repeated-measurement regression.

Person-Clustered Uncertainty and Longitudinal Modeling

One approach is to keep the chosen regression mean model and calculate uncertainty with a person-clustered sandwich variance. In the usual large-cluster-count setting, this allows the errors to be correlated in an unspecified way among records from the same person, while relying on independence across people. Its key advantage is that it need not specify whether same-person correlation follows an autoregressive pattern, an equal-correlation pattern, or another pattern.

In matrix notation, let \(X_i\) contain the design rows for person \(i\), and let \(\hat e_i\) be that person's vector of fitted residuals. A basic form of the clustered sandwich variance estimator is:

$$ \widehat{\operatorname{Var}}_{\mathrm{cluster}}(\hat{\beta}) = (X^\mathsf{T}X)^{-1} \left(\sum_{i=1}^{G}X_i^\mathsf{T}\hat e_i\hat e_i^\mathsf{T}X_i\right) (X^\mathsf{T}X)^{-1} $$

Here \(G\) is the number of people. The middle term aggregates each person's contribution as a whole, rather than treating each row as a separate independent contribution. Inference based on this estimator relies on having a sufficiently large number of independent people; a large row count created by repeatedly measuring only a few people does not substitute for many independent clusters. Small-sample adjustments and few-cluster concerns require particular care.

A longitudinal model, by contrast, specifies more directly how measurements from the same person relate over time. For example, it might use an autoregressive error structure or another explicit covariance model. Such a model can use the assumed pattern to estimate the mean relationship and its uncertainty, and a well-chosen structure may improve efficiency. Its conclusions then depend on whether the specified longitudinal structure is reasonable.

These approaches answer related but different questions. Person-clustered standard errors ask, in effect, how uncertain the regression coefficients are when within-person dependence is allowed without specifying its detailed form. A dedicated longitudinal model makes the time-related dependence itself part of the model. Neither approach automatically repairs a misspecified mean relationship, addresses confounding, or establishes a causal effect.

Worked Example: Comparing Two Standard-Error Calculations

Consider a small hypothetical intercept-only analysis with four people measured twice. The eight outcomes are: person A, 10 and 12; person B, 12 and 14; person C, 14 and 16; person D, 16 and 18. The fitted intercept is the overall mean, \(\bar{y}=14\).

Independent-row calculation. The residuals from 14 are \(-4,-2,-2,0,0,2,2,4\). Their squared sum is \(48\), so the residual variance estimate is \(s^2=48/(8-1)=6.857\). Treating all eight rows as independent gives:

$$ SE_{\mathrm{independent}}(\bar{y}) = \sqrt{\frac{6.857}{8}} = 0.926 $$

Person-clustered calculation. The sum of residuals within each person is \(-6,-2,2,6\), respectively. In this intercept-only example, the uncorrected cluster sandwich variance is the sum of squared person residual sums divided by the square of the total number of rows:

$$ \widehat{\operatorname{Var}}_{\mathrm{cluster}}(\bar{y}) = \frac{(-6)^2+(-2)^2+2^2+6^2}{8^2} = \frac{80}{64} = 1.25 $$

Thus the uncorrected clustered standard error is \(\sqrt{1.25}=1.118\). As one illustrative finite-sample adjustment, multiplying the variance by \(G/(G-1)=4/3\) gives an adjusted variance of \(1.25(4/3)=1.667\) and an adjusted standard error of \(\sqrt{1.667}=1.291\). The independent-row calculation is smaller here, but with only four people the clustered estimate is itself highly uncertain; the adjusted value should not be treated as a dependable final inference.

This example demonstrates what clustering changes: the calculation groups residual contributions by person. It does not estimate or explain the sequence of correlations between visit 1 and visit 2, and it cannot turn four people into a large independent sample. A longitudinal model would instead represent the within-person relationship through its chosen covariance assumptions.

Common Mistakes and Practical Meaning

  • Counting rows as independent people. Four visits for each of 50 people are 200 records, but only 50 independent people under the stated independence-across-people assumption.
  • Assuming clustered standard errors model time. Clustering by person permits within-person correlation for uncertainty estimation; by itself, it does not specify how correlation changes with the time gap.
  • Thinking clustering changes the estimated coefficient. With the same mean model and data, changing only the variance estimator changes standard errors and related inference, not the fitted coefficient estimates.
  • Assuming a larger record count solves few-cluster problems. Adding more time points to the same small set of people does not provide the same independent information as adding people.
  • Interpreting a corrected standard error as a cure-all. Neither a clustered variance nor a longitudinal covariance assumption fixes a poor mean model or justifies a causal interpretation on its own.

The practical choice depends on the goal and the data. If the primary goal is inference for a regression mean and there are many independent people, person-clustered uncertainty can be a useful way to avoid asserting a detailed within-person correlation pattern. If the timing pattern is central to the scientific question, or if the analysis needs to use an explicit model of that pattern, a longitudinal approach is more directly suited to the task. The assumptions should be stated plainly either way.

Key takeaway: Repeated observations are grouped by person, and their errors may also be serially dependent across time. Person-clustered standard errors allow unspecified within-person dependence for regression inference; longitudinal models specify a time-related dependence structure. Both require appropriate assumptions, and neither makes repeated rows equivalent to independent people.

Check Your Understanding

Use the ideas in this tutorial to answer the following questions.

  1. A study measures each of 45 participants monthly for six months. How many rows are in the complete data set, and what is the independent cluster if participants are independent of one another?
  2. Under the stated first-order autoregressive pattern, what is the correlation between errors three occasions apart when \(\rho=0.5\)?
  3. Why can positive serial correlation make the variance of a person's repeated-measurement average exceed the variance calculated under independence?
  4. What assumption about the form of within-person correlation does person-clustered sandwich uncertainty avoid making? What assumption about different people remains?
  5. Explain one way a dedicated longitudinal model differs from using person-clustered standard errors alone.