Why the Observation Unit Matters
Before fitting a generalized linear mixed model (GLMM), determine what one outcome record represents. A data table may have one row per person, one row per visit, one row per classroom, or one row per site. These are different data structures, even if they contain a column with the same outcome name. The row unit determines what is counted as an observation in the model and helps reveal which records may be related.
In clustered data, several kinds of units can occur at once. A person may be measured at several visits; students may be sampled within classrooms; patients may receive care at sites. The subject or sampling unit is not necessarily the unit represented by a row, and neither is necessarily the cluster whose members may be associated. Naming each unit explicitly prevents the common error of treating rows as interchangeable, independent pieces of information.
These definitions do not imply that the units are always different. In a study measuring each person once, the person may be the observational unit, subject, and sampling unit. In a repeated-measures study, each visit may produce an observational unit while the person is the subject and cluster. In a classroom sample, the student may be the observational unit, the classroom may be the sampling unit and cluster, and the school may be a higher-level grouping.
The key question is not “What is a row called in the software?” but “What entity does the response in this row describe?” Answer it from the protocol and outcome definition, then verify that the table follows that design.
Rows, Clusters, and the Model’s Likelihood
Let \(Y_{ij}\) denote the response for observational unit \(i\) in cluster \(j\), and let \(b_j\) denote a cluster-specific random effect. In a common GLMM setup, rows within a cluster are modeled as conditionally independent given the random effect and covariates, while the random effect allows their outcomes to be associated marginally. Distinct clusters are commonly assumed independent, conditional on the model specification.
Here \(J\) is the number of clusters and \(n_j\) is the number of observational units in cluster \(j\). The product over \(i\) represents the outcome records within a cluster, conditional on \(b_j\); the outer product combines cluster contributions. Thus, eight rows from three people measured repeatedly are eight outcome records but only three person clusters. Calling all eight rows independent people would misstate the data structure.
The expression is a justification for keeping the row unit and cluster unit distinct; it is not a general recipe for choosing a model. Its interpretation depends on the response distribution and random-effects structure being appropriate, and on the assumed conditional independence and between-cluster independence being reasonable. If a table aggregates several units into one record, its likelihood contribution must match that aggregated response rather than pretending the record is an individual outcome.
Worked Example: Repeated Clinic Visits
Suppose a hypothetical clinic records a binary symptom indicator at each scheduled visit for three patients. Patient A has records at baseline, week 4, and week 8; Patient B has baseline and week 4; Patient C has baseline, week 4, and week 8. What does a row represent, and how many observational units and clusters are present?
The protocol says the symptom is recorded at each visit, so one response record represents one patient-visit. The visit record is the observational unit; the patient is the subject and the cluster, because visits from the same patient can be related.
The row count is \(3+2+3=8\) patient-visits. There are \(J=3\) patient clusters, with cluster sizes \(n_A=3\), \(n_B=2\), and \(n_C=3\). The model’s conditional outcome contribution has eight terms, grouped into three cluster contributions:
It would be incorrect to report eight patients: there are three patients and eight measurements. It would also be incorrect to collapse the rows to three patient-level values without defining a new outcome, such as “ever had the symptom.” That new outcome would answer a different question and discard information about visit timing.
Cluster-Sampled Data: Who Was Sampled and Who Was Measured?
A cluster sampling design does not by itself determine the observational unit. If classrooms are selected and student outcomes are recorded, students are the response units and classrooms group them. If the study records only a classroom-level outcome, such as the classroom’s attendance rate, the classroom is the observational unit. The sampling stage and response definition must both be considered.
Worked Example: Students Sampled Within Classrooms
In a hypothetical school survey, four classrooms are selected and three students are measured in each classroom. Each student contributes one binary indicator for whether they met a study-defined activity threshold. Identify the observational unit, cluster, and record counts.
The response is defined for each student, so the student is the observational unit. The classroom is the cluster, and also the sampling unit selected at the first stage. There are \(4\times 3=12\) student response records and \(J=4\) classroom clusters, each with \(n_j=3\) students.
The records are not automatically 12 independent observations: students in the same classroom may share instruction, schedules, or other conditions. A GLMM for student-level responses can represent classroom-level variation, subject to the model assumptions. Treating each classroom as one row instead would require defining a classroom-level outcome, such as the proportion of sampled students meeting the threshold. That changes the observational unit and the target of the analysis.
This example also shows why “cluster-sampled” and “cluster-level outcome” are not synonyms. The classrooms were selected as sampling units, but the response was observed on students.
When the Site Is the Observation Unit
Sometimes the study’s response is defined for a site rather than for each person at that site. The number of rows then depends on the site-level records, not on how many people contributed information to each site summary. The distinction matters because a site-level analysis cannot be interpreted as if it had one person-level outcome per resident or patient.
Worked Example: A Site-Level Summary
A hypothetical evaluation covers five health sites. For each site, the data team records the site’s number of completed referrals divided by its number of eligible referrals, producing one completion proportion. The site totals are based on 40, 50, 60, 45, and 55 eligible referrals, respectively. What is the observational unit?
The recorded response is one completion proportion per site. Therefore, the observational unit is the site, and the table contains five outcome records. The referrals are inputs to each site’s summary; they are not five groups of individual binary rows in this analysis table.
The total number of eligible referrals contributing to the five summaries is \(40+50+60+45+55=250\), but that does not make this dataset a 250-row person-level dataset. The analysis as described has five site-level records. A model using site-level proportions has to account for how those proportions were formed and what precision information is available; it cannot simply treat each site proportion as a patient response.
If instead the study retained one binary outcome for every referral, the observational unit would be the referral and the site would be the cluster. Those two data arrangements can arise from the same underlying evaluation but answer questions at different levels.
A Practical Identification Process
Use a short sequence of questions before interpreting any model formula or output. The answer should be stated in plain language, not inferred solely from variable names.
Ask what entity has one value of the outcome: a person, person-visit, student, classroom, or site. If several entities are summarized into one value, name the summarized unit.
Check whether each row is one outcome record as defined in the protocol. Do not assume that a row means a person merely because the dataset contains person-related variables.
Identify which records share a person, classroom, clinic, or other grouping factor. A repeated-measures person can be both subject and cluster; a site may cluster patient records.
Report the number of outcome records and the number of clusters separately, along with unequal cluster sizes when relevant. These counts should reconcile with the protocol and table.
Confirm that the response distribution and likelihood contribution correspond to the recorded outcome unit, and that the dependence structure represents the grouping in the design.
Common Misreadings and Diagnostics
A useful diagnostic is to describe one row aloud: “This row is the symptom status for patient A at week 4,” or “This row is the attendance rate for classroom 12.” If that sentence cannot be completed from the dataset documentation, the unit has not been established clearly enough.
- Counting rows as independent subjects. Repeated measurements can create multiple rows per person. State the number of response records and the number of people separately.
- Assuming the sampling unit is the response unit. Selecting classrooms does not make the classroom the observational unit if each student has a separately recorded response.
- Assuming the response unit is always an individual. A site rate or classroom mean is a group-level outcome if the analysis contains one such response per group.
- Using an aggregated value without recognizing the change. Aggregation changes what one outcome record represents and may remove within-group detail.
- Ignoring hierarchy in the protocol. A person may be measured over time and also belong to a site. If the design supports more than one source of grouping, a single label may not capture the full dependence structure.
Counts are a basic consistency check, not proof that the table is correct. For example, the expected number of person-visits can be compared with the number of protocol-specified visits, or the number of student records with the selected classrooms and sampled students per classroom. Unexpected discrepancies can indicate missing measurements, duplicate records, or an incorrect interpretation of what a row represents. Their cause must be investigated rather than repaired by assumption.
Choosing Between Individual and Aggregated Records
Individual-level records preserve the separate outcomes and can support questions about variation among people or visits, provided the model represents their clustering. Aggregated records can be appropriate when the scientific question is genuinely about groups or when only group summaries are available, but they usually discard information about within-group variation. Neither format is automatically superior: the choice depends on the outcome definition, the question, and the information retained.
A frequent mistake is to argue that a group summary gives “more independent data” because there is one row per group. The number of rows is not a general measure of information or independence. A site-level dataset with five rows has five site outcomes; it does not create 250 independent outcomes merely because the summaries used 250 referrals. Conversely, person-level rows from a small number of classrooms do not become independent just because every student has a separate row.
The observational unit also does not, by itself, determine the causal or scientific unit of interest. The experimental unit is determined by treatment assignment, while the response unit is determined by outcome recording. These can differ. A treatment assigned to classrooms with outcomes measured on students has classroom experimental units and student observational units; treating those as the same can lead to an analysis that does not reflect the assignment design.
Check Your Understanding
Answer each question by naming the observational unit and any relevant cluster. Then compare your reasoning with the solutions.
- A hypothetical study records blood pressure for each participant at baseline and month 6. What is the observational unit, and what is the subject cluster?
- Researchers select six clinics and record one clinic-level percentage for each. How many observational units are in the data, and what entity do they represent?
- A study selects classrooms and records one reading score for each sampled student. Are the classrooms or students the observational units?
- There are five patients with four visits each, with no missing visits. How many outcome records and patient clusters are present?
- Explain why 100 patient-level rows from two hospitals should not automatically be treated as 100 independent hospital-level units.
Solutions. (1) Each participant-visit is an observational unit; the participant is the subject and repeated-measures cluster. (2) There are six observational units, each representing a clinic, because one percentage is recorded per clinic. (3) Students are the observational units because each has a separately recorded score; classrooms are clusters and sampling units. (4) There are \(5\times4=20\) outcome records and five patient clusters. (5) The rows represent patients, while the hospital is the grouping unit; patients in the same hospital may share conditions, so 100 patient records do not constitute 100 independent hospitals.