Why Repeated Records Need a Two-Level View
A longitudinal dataset often contains several records for each person: one row per person-visit, person-month, or person-assessment. Those rows are not independent people. They are repeated observations from the same individual, and they may share stable characteristics or unmeasured influences. An imputation model that treats every row as an unrelated unit can therefore misrepresent the variation and dependence in the data.
The basic task here is to identify the two levels before specifying an imputation model. Level 2 is the person; level 1 is a repeated record within that person. This description does not require that everyone have the same number of records or that observations occur at equally spaced times. It does require a clear record-to-person mapping and a decision about which variables belong to which level.
For example, blood pressure measured at each visit is a level-1 variable, while a person's treatment assignment at baseline is typically level 2. Age requires care: age recorded at each visit changes across records and can be treated as level 1; age measured only at study entry is a single baseline characteristic and is level 2. The variable's meaning and how it was recorded determine its level, not its name.
This indexing clarifies the data structure, but does not by itself prescribe a particular model for time, serial dependence, or changing covariate effects. Those are additional modeling choices. Here the central question is how to preserve the fact that multiple records belong to one person when constructing conditional imputation models.
From Records to Variables and Imputation Targets
Before imputing anything, identify the person identifier, the repeated-record index, each variable's level, and the unit at which the variable is genuinely observed. The person identifier links records; it is not usually an explanatory variable whose numeric value should enter the model. A level-2 value copied onto several rows remains one person-level value, not several independent measurements.
| Data item | Typical level | How it appears in repeated records |
|---|---|---|
| Person identifier | Identifies level 2 | Same identifier on all records for a person |
| Visit-specific symptom score | Level 1 | May differ at each record |
| Baseline treatment assignment | Level 2 | Same value on all records for a person |
| Visit number or measurement occasion | Record-level descriptor | Labels the position of a record |
In chained equations, each incomplete variable is modeled conditionally on other variables. For a repeated-record target, the conditional model should generally represent both the association among records from the same person and relevant information at both levels. For a person-level target, the conditional model must be fitted at the person level, or otherwise be constructed so that repeated copies do not give a person with more records disproportionate influence.
One basic continuous-outcome model illustrates the structure:
Here \(Y_{ij}\) is the incomplete or modeled level-1 variable, \(X_{ij}\) is a level-1 predictor, \(Z_i\) is a level-2 predictor, \(u_i\) is a person-specific random intercept, and \(\varepsilon_{ij}\) is record-specific residual variation. The usual random-intercept formulation assumes that the \(u_i\) are independent across people, the residuals are independent across records conditional on the random intercept and predictors, and both components have mean zero with the stated variances. It also assumes the conditional mean is adequately represented by the specified predictors and that the random intercept is independent of those predictors, unless the model is extended to address dependence.
In an imputation setting, this equation is a model for the conditional distribution of a missing \(Y_{ij}\) given observed and currently imputed information. It is not enough to substitute a predicted mean and fill in the missing cell: an imputation procedure must also represent appropriate residual and model uncertainty. The precise fitting and drawing steps depend on the chosen multilevel imputation method.
Why the Random Intercept Represents Dependence
A short derivation shows why the person term matters. Consider two distinct records \(j\ne k\) from the same person, with predictors treated as fixed. Their random parts are \(u_i+\varepsilon_{ij}\) and \(u_i+\varepsilon_{ik}\). If the record-specific residuals are independent of each other and of \(u_i\), then:
For a single record, the corresponding conditional variance is \(\tau^2+\sigma^2\). Thus the within-person correlation under this simple model is \(\tau^2/(\tau^2+\sigma^2)\). This is a consequence of the random-intercept assumptions, not a universal description of all longitudinal dependence. If those assumptions are inappropriate, a random intercept alone may not capture the dependence in the records.
Worked Example: Counting Records and Classifying Variables
Suppose a hypothetical study follows three people. Person A has records at three visits, B has records at two visits, and C has records at three visits. Each record contains a symptom score, the visit label, and the person's baseline treatment assignment. How many records are present, and what is the level of each item?
The number of people is \(N=3\), and the record counts are \(n_A=3\), \(n_B=2\), and \(n_C=3\). Therefore, the number of records is:
The symptom score is level 1 because it is measured on each record and can change across visits. The visit label describes the record's occasion. Baseline treatment is level 2: although it may be repeated in all eight rows for convenience, there are only three independently assigned person-level values. For example, if A and C received treatment and B did not, the person-level values are \(Z_A=1\), \(Z_B=0\), and \(Z_C=1\); repeating these labels across visits does not turn them into eight treatment assignments.
A suitable two-level representation therefore indexes symptom as \(Y_{ij}\), treatment as \(Z_i\), and the record label by its within-person occasion. The unequal record counts do not change the two-level definition, though they can affect the information available about each person's pattern.
Worked Example: Translating a Continuous Target Into a Conditional Model
Consider hypothetical repeated records with a continuous activity score \(X_{ij}\), a measured health score \(Y_{ij}\), and a person-level treatment indicator \(Z_i\). One value of \(X_{ij}\) is missing. For illustration, suppose a fitted conditional mean has the form:
Assume the missing value is for a record with \(Y_{ij}=5\), occasion code \(t_{ij}=1\), and \(Z_i=1\). Suppose the current person-specific effect in this hypothetical calculation is \(b_i=-0.3\). Substitution gives:
The model's conditional mean for this record is 5.0 activity-score units. That number is not, by itself, a completed imputation: a valid stochastic imputation also reflects uncertainty in the model and variation around its conditional mean. The person effect links the target record to the person's other records, while \(Z_i\) contributes information at the person level. This simple specification is only appropriate if its conditional mean and distributional assumptions are defensible for the target.
Worked Example: The Consequence of Repeating a Person-Level Value
Suppose three hypothetical people have a person-level biomarker value \(Z_i\) equal to 2, 4, and 10. The first person contributes three records, the second contributes two, and the third contributes one. What is the mean across people, and what mean would result from treating the copied record-level values as six independent person-level observations?
The mean across the three people is:
If the values are copied to every record, the six-row list is \(2,2,2,4,4,10\). Its mean is:
The two means differ because the record-level calculation weights people in proportion to their record counts. It answers a different question: the average copied value over records, not the average across people. This illustrates why a person-level target cannot be treated as though each repeated copy were a new independent observation.
Assumptions, Diagnostics, and Alternatives
A two-level data layout is a structural description; it does not guarantee that a chosen imputation model is correct. The analyst still needs a plausible conditional model for each incomplete variable, compatible predictor sets across levels, and an appropriate treatment of the outcome type. A normal random-intercept model, for instance, can be unsuitable for a strongly skewed or bounded variable without adaptation. For binary, ordinal, nominal, or count targets, the conditional distribution must match the outcome scale.
As with other imputation under a missing-at-random assumption, the observed information in the model must be sufficiently rich: conditional on included observed data, the probability that a value is missing should not depend on its unobserved value. If missingness still depends on the missing value after conditioning, a missing-not-at-random model or sensitivity analysis may be needed. The longitudinal structure alone does not establish this assumption.
Useful structural checks include confirming that each record maps to exactly one person, that person-level variables are constant within person where they should be, and that record counts and missingness patterns are plausible. After imputation, inspect whether within-person and between-person variability are both represented, whether imputed values stay within meaningful ranges, and whether people with many records dominate a model for a person-level target. Implausibly narrow within-person variation can signal that the model has not retained record-level residual variation; implausible between-person distributions can indicate a poorly specified person-level component.
Identify people, repeated records, and the person identifier; calculate \(n=\sum_i n_i\) and check for duplicate or unlinked records.
Decide whether it varies by record or is defined once per person. Do not infer level solely from the fact that a value is repeated in the file.
Include relevant information from both levels and represent dependence among repeated records when imputing a level-1 variable.
Assess outcome scale, within-person dependence, missing-at-random plausibility, and whether a person-level target is being weighted at the correct unit.
A rowwise single-level model is simpler and may be reasonable when clustering is negligible for the target and analysis, but it assumes away residual dependence if it treats all records as independent. Aggregating to one summary per person avoids duplicate person-level contributions, but discards record-specific information and cannot represent variation across repeated outcomes. A two-level model retains the record-level observations while accounting for shared person-level structure. Its cost is greater modeling complexity and dependence on assumptions about the random effects and conditional distributions.
A common mistake is to say, “There are eight rows, so there are eight independent units for every variable.” The correction is to distinguish the number of records from the number of people: a level-1 analysis may use all eight records, but records from the same person are clustered; a level-2 value still has only three person-level realizations. Another mistake is to assume that adding a person identifier as an ordinary numeric predictor solves clustering. An identifier is a label, not a meaningful quantitative covariate; dependence must be represented through an appropriate multilevel structure or another justified model.
Check Your Understanding
Answer each question, then compare your reasoning with the brief solutions.
- Five people contribute 2, 3, 3, 1, and 2 records. How many level-1 records are there, and what is \(N\)?
- A person's baseline smoking status is copied into every visit row. Is it a level-1 variable merely because it appears on each row? Explain.
- Under a random-intercept model with \(\tau^2=4\) and \(\sigma^2=6\), find the variance of one record and the correlation between two distinct records from the same person.
- Why can a rowwise mean of a person-level variable differ from the mean across people when people have different numbers of records?
- Name one limitation of aggregating all repeated measurements to a single summary per person for imputing a visit-specific outcome.
Solutions. (1) \(n=2+3+3+1+2=11\) records, and \(N=5\) people. (2) No. It remains level 2 because it is defined once for the person; copying it across rows does not create new independent values. (3) The record variance is \(\tau^2+\sigma^2=4+6=10\). The within-person correlation is \(\tau^2/(\tau^2+\sigma^2)=4/10=0.400\). (4) The rowwise calculation weights each person by their number of records, whereas a mean across people gives each person equal weight. (5) Aggregation discards occasion-specific information and cannot preserve the variation among records within a person.