Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

What Are Nested or Hierarchical Data?

Nested or hierarchical data occur when lower-level observations belong to higher-level groups, such as students within classrooms or repeated measurements within people. This structure matters because observations in the same group are often more similar than observations from different groups.

124
Nested or Hierarchical Data Guide 124 of 223
01 · The Question

What Does It Mean When Your Observations Belong Inside Other Observations?

Suppose you survey 2,000 students from 100 classrooms in 20 schools.

You have 2,000 student observations, but those students are not simply 2,000 unrelated cases.

Students in the same classroom share a teacher, classmates, instructional practices, and classroom environment. Classrooms in the same school may share leadership, policies, resources, and institutional culture.

The structure looks like this:

Students within classrooms within schools

This is an example of nested or hierarchical data.

The same structure appears when employees are nested within departments, patients within hospitals, children within families, citizens within countries, and repeated observations within individuals.

Nesting matters because observations that share a higher-level context may resemble one another. Treating all lower-level observations as though they were completely independent can therefore distort standard errors, effective sample information, and the interpretation of relationships operating at different levels.

02 · The Short Answer

Nested Data Have Lower-Level Observations Grouped Within Higher-Level Units

In Brief

Nested or hierarchical data occur when observations at one level belong to identifiable units at a higher level, such as students within classrooms, employees within organizations, or repeated measurements within people.

Observations within the same higher-level unit may be correlated because they share environments, characteristics, or histories. This violates the simple independence assumption used by many ordinary statistical procedures and often motivates clustered standard errors, multilevel models, generalized estimating equations, or other methods designed for dependent data.

03 · What You Need to Know

Nesting Means the Data Have More Than One Structural Level

The simplest hierarchy has two levels

Consider students enrolled in classrooms.

You might describe the structure as:

Level 1: Students

Level 2: Classrooms

Each student belongs to one classroom, and several students share the same classroom.

This creates clusters of observations.

Another example is employees within organizations:

Level 1: Employees

Level 2: Organizations

The lower-level observations are nested inside higher-level units.

A hierarchy can have more than two levels

Educational data often have structures such as:

Students → Classrooms → Schools → Districts

Organizational data might contain:

Employees → Teams → Departments → Companies

Health data might contain:

Patients → Physicians → Clinics → Health systems

The levels do not have to be equally important to every research question, but they exist in the data structure.

Repeated measurements can also be nested

Nesting does not require groups of different people.

Suppose 200 participants report stress every day for 30 days.

The hierarchy is:

Level 1: Daily observations

Level 2: Participants

Each participant contributes many repeated observations.

Measurements from the same person are likely to resemble one another more than measurements drawn from different people.

This is why repeated-measures and longitudinal data are also commonly analyzed using multilevel or mixed-effects approaches.

The fundamental issue is dependence

Many familiar statistical procedures assume that observations are independent.

Informally, independence means that knowing something about one observation does not provide systematic information about another observation after accounting for the model.

Nested data challenge this assumption because members of the same group share context.

Students in the same classroom may be similar because they:

  • have the same teacher;
  • receive the same instruction;
  • interact with the same classmates;
  • use the same resources;
  • experience the same classroom climate.

Ignoring that common context can make the data appear to contain more independent information than they really do.

Clustering does not mean everyone in a group is identical

Students within one classroom can still differ considerably in ability, motivation, achievement, and background.

Nesting simply means that there may be an additional source of similarity associated with group membership.

A useful way to think about the outcome is:

Some variation occurs between individuals within groups.

Some variation may occur between groups.

Multilevel analysis can separate those sources.

A simple variance decomposition makes the hierarchy visible

Suppose the outcome is student achievement.

Conceptually:

Two-Level Variance
Total variation = between-classroom variation + within-classroom variation
Students differ from one another within classrooms, while classrooms may also differ in their average achievement levels.
If some classrooms consistently score higher than others while students also vary substantially within each classroom, both levels contribute to the observed outcome variation.

This distinction is central to understanding levels of analysis.

The intraclass correlation coefficient summarizes clustering

In a simple random-intercept model, the intraclass correlation coefficient, or ICC, can describe how much outcome variation is associated with differences between higher-level groups.

Intraclass Correlation
ICC = σ²between / (σ²between + σ²within)
σ²between is the modeled variance between groups and σ²within is the modeled variance among observations within groups.
If between-classroom variance is 10 and within-classroom variance is 40, ICC = 10 / 50 = 0.20.

An ICC of.20 in this simplified example indicates that about 20% of the modeled outcome variation lies between classrooms.

Another interpretation is that two randomly selected students from the same classroom tend to be more similar than two randomly selected students from different classrooms, to an extent summarized by the ICC under the model.

An ICC of zero would imply no modeled clustering in the outcome

If the between-group variance were essentially zero, group membership would contribute little to similarity in the outcome under the fitted model.

But researchers should not conclude that the hierarchy therefore does not exist.

Students are still physically nested within classrooms. Group-level predictors or random slopes may still be substantively relevant, and uncertainty in an estimated ICC should also be considered.

Hierarchy is a property of the design; ICC quantifies one aspect of how strongly that hierarchy appears in a particular outcome.

Even modest ICCs can matter when groups are large

Suppose an ICC is only.05, but each classroom contains 50 students.

Because many students share the same cluster, even modest within-cluster similarity can substantially reduce the amount of independent information compared with a simple random sample of unrelated individuals.

This is often summarized using a design effect.

Approximate Design Effect
DE = 1 + (m - 1)ICC
m is the average cluster size in the simplest equal-size approximation.
If m = 50 and ICC =.05, DE = 1 + 49(.05) = 3.45. The clustering can therefore materially affect sampling precision even though the ICC itself appears numerically modest.

Real designs may have unequal cluster sizes and additional complexities, so this formula should be treated as an introductory approximation rather than a universal sample-size solution.

Ignoring nesting can make standard errors too small

Suppose 1,000 students are nested in 20 schools.

An ordinary regression that treats all 1,000 student observations as independent may act as though the sample contains more independent information than it actually does.

If students within schools are positively correlated, standard errors can be underestimated.

This can make confidence intervals too narrow and statistical tests too optimistic.

Watch Out

A large number of lower-level observations does not mean you have the same number of independent higher-level contexts. One thousand students from 20 schools contain information from 1,000 students but only 20 observed schools.

Nested data do not automatically require one particular statistical method

Multilevel or mixed-effects modeling is one common approach, but it is not the only way to address dependence.

Depending on the question and design, researchers might use:

  • multilevel or hierarchical models;
  • linear or generalized linear mixed-effects models;
  • cluster-robust standard errors;
  • generalized estimating equations;
  • fixed-effects models;
  • design-based survey methods;
  • analysis at the cluster level.

The appropriate strategy depends on whether researchers want to estimate higher-level variance, group effects, within-group effects, cross-level interactions, population-average effects, or something else.

Multilevel models explicitly represent the hierarchy

A basic two-level random-intercept model might be written conceptually as:

Two-Level Model
Yᵢⱼ = β₀ + β₁Xᵢⱼ + uⱼ + eᵢⱼ
i indexes lower-level observations, j indexes groups, uⱼ represents group-level deviations, and eᵢⱼ represents lower-level residual variation.
Students in the same classroom share the same classroom-specific component uⱼ while retaining their own individual residuals eᵢⱼ.

This is what allows the model to represent similarity among observations in the same cluster.

A random intercept allows groups to have different baselines

Suppose the outcome is AI adoption among faculty.

Universities may differ in their average adoption rates because of infrastructure, leadership, policy, institutional history, and other shared influences.

A random intercept allows each university to have its own deviation from the overall average.

That captures residual between-university variation not explained by included predictors.

Random slopes allow relationships to differ across groups

Suppose faculty self-efficacy predicts AI adoption.

The relationship may be stronger in some universities than others.

A random-slope model can allow the self-efficacy coefficient to vary across universities.

This raises a deeper multilevel question:

Why does the relationship vary?

A university-level variable may then be used to explain that variation.

This connects directly to cross-level relationships.

Nesting often creates variables at several levels

Consider students within classrooms.

Student-level variables Classroom-level variables
Motivation Class size
Prior achievement Teacher experience
Study time Instructional method
Self-efficacy Classroom climate

A multilevel research question may therefore ask what happens within classrooms, what differs between classrooms, or how classroom characteristics relate to individual students.

Not every higher-level unit must be a substantive unit of analysis

Suppose students are nested in schools, but the only substantive question is:

Does individual motivation predict individual achievement?

Schools still create clustering and may need to be accounted for statistically.

But the research does not necessarily have a substantive school-level hypothesis.

This distinction is important when deciding whether a study truly has more than one unit of analysis.

Statistical clustering and substantive multilevel theory are not the same thing

You can have clustered data without having a multilevel substantive theory.

For example, schools may simply be sampling clusters.

Conversely, you can have an important multilevel theory about institutional effects and then discover that your dataset contains too few institutions to test it adequately.

The data structure and theoretical structure should therefore be distinguished.

Nested data create within-group and between-group relationships

Suppose employee workload predicts burnout.

There are at least two possible relationships:

Within organizations: Do employees with heavier workloads than their colleagues experience more burnout?

Between organizations: Do organizations with higher average workloads have higher average burnout?

These are different statistical comparisons.

A raw individual workload coefficient in a multilevel dataset can combine within- and between-group information unless the model is specified to separate them.

Group-mean centering can separate within-group variation

Researchers can calculate:

Within-Group Predictor
Xᵢⱼ - X̄ⱼ
This represents how much an individual's score differs from the mean of their own group.
If an employee's workload score is 6 and their organization's mean is 4, the within-organization deviation is +2.

The group mean, X̄ⱼ, can then be included separately to represent between-group differences.

This makes the interpretation clearer because within-group and between-group effects can differ substantially.

The same predictor can have different within- and between-group effects

Suppose within universities, faculty members who use AI more frequently also report greater self-efficacy.

But universities with higher average AI use might not have higher average self-efficacy because heavily adopting universities may include mandatory implementation policies that bring reluctant users into the system.

The individual and university relationships therefore need not match.

This is one reason relationships can differ across levels of analysis.

Nested structures can be cross-classified rather than strictly hierarchical

Not every dataset fits neatly into one tree.

Suppose students take courses from several teachers.

A student may belong to multiple instructional contexts rather than being nested entirely within one teacher.

Likewise, patients may receive care from several physicians, and employees may participate in multiple project teams.

These structures are cross-classified rather than strictly nested.

They may require models that recognize membership in multiple higher-level units.

Multiple membership is another extension

Suppose a patient's outcome is influenced by several hospitals or providers during treatment.

Assigning the patient to only one cluster may misrepresent the exposure structure.

Multiple-membership models can allow observations to belong partly to several higher-level units.

The broad lesson is that “hierarchical” should not be interpreted as meaning every real dataset forms one perfectly simple pyramid.

Longitudinal data can contain multiple levels simultaneously

Suppose faculty members report AI use monthly and faculty are nested within universities.

The structure becomes:

Level 1: Monthly observations

Level 2: Faculty members

Level 3: Universities

The study can now separate variation across time within a faculty member, variation among faculty members, and variation among universities.

Nested data matter for measurement too

Suppose researchers measure organizational climate through employee surveys.

Responses contain both individual-level and organization-level covariance.

A single-level factor analysis may blend those structures together.

The factor structure of individual perceptions need not be identical to the factor structure of differences among organizations.

Multilevel measurement models can explicitly separate those levels when the research question requires it.

Cluster-randomized trials are inherently hierarchical

Suppose schools rather than individual students are randomly assigned to an intervention.

Students are nested within randomized schools.

The treatment assignment therefore occurs at the school level, even though outcomes may be measured on thousands of students.

The analysis should respect that assignment structure.

Treating every student as an independently randomized experimental unit would create a unit-of-analysis error.

The number of clusters matters independently of the number of individuals

Suppose a trial includes 4,000 students but only eight schools.

There are many student observations but very little independent information about variation among randomized schools.

Estimation of school-level variance, treatment effects assigned at school level, and cross-level interactions can therefore be difficult.

Lower-level sample size cannot fully compensate for very few higher-level units.

Unequal cluster sizes can complicate the design further

One classroom may contain 15 students while another contains 60.

One hospital may contribute 20 patients while another contributes 2,000.

Unequal cluster sizes influence precision and can affect simple design-effect approximations.

The analytical method should therefore use the actual cluster structure rather than assuming perfectly balanced groups when they are not.

The hierarchy should be identified during study design

Before collecting data, researchers should ask:

  • What are the lower-level observations?
  • What higher-level units contain them?
  • How many units exist at each level?
  • Which variables are measured at each level?
  • At what level is treatment or exposure assigned?
  • At what level will conclusions be made?

These decisions affect sampling, power, measurement, analysis, and interpretation.

More observations do not necessarily mean more independent information

This principle is worth emphasizing.

If one person provides 500 measurements, you have 500 observations from one person, not 500 independent people.

If 2,000 students come from three schools, you have extensive student information but only three observed schools.

Nested data force researchers to distinguish the number of records from the number of independent higher-level units.

04 · A Practical Example

Faculty Members Nested Within Universities

Hypothetical Example

Studying faculty adoption of generative AI

Researchers survey 3,000 faculty members working in 60 universities. Faculty report AI teaching self-efficacy and classroom AI adoption. Universities differ in institutional AI infrastructure.

Level 1 Faculty members are the lower-level units. Self-efficacy and personal AI adoption vary among faculty.
Level 2 Universities are higher-level units. Infrastructure varies among universities.
Clustering Faculty from the same university may resemble one another because they share policies, leadership, infrastructure, and institutional culture.
Individual-level question Do faculty members with greater AI self-efficacy report greater personal adoption?
Cross-level question Do faculty members working in universities with stronger infrastructure report greater adoption?

A multilevel model can preserve faculty-level variation while recognizing that faculty are grouped within universities.

The study therefore does not have 3,000 independent institutional contexts. It has 3,000 faculty observations organized within 60 universities.

05 · What Researchers Often Get Wrong

Common Mistakes With Nested and Hierarchical Data

Misconception

If I have thousands of observations, clustering no longer matters

No. Large lower-level samples do not eliminate dependence among observations from the same cluster, and they do not create additional higher-level units.

Misconception

A small ICC means I can always ignore the hierarchy

No. Even modest clustering can affect uncertainty when cluster sizes are large, and the hierarchy may remain theoretically important for group-level or cross-level questions.

Misconception

Every nested dataset requires a random-intercept multilevel model

No. Multilevel models are one family of solutions. Cluster-robust inference, fixed-effects approaches, generalized estimating equations, survey methods, or cluster-level analyses may be more appropriate for some questions.

Misconception

If groups are not my primary topic, I can ignore them statistically

Not necessarily. Groups can induce dependence even when the substantive question is entirely individual-level.

Misconception

The relationship among individuals must be the same as the relationship among groups

No. Within-group and between-group relationships represent different variation and can differ substantially.

Misconception

Hierarchical data always form one perfect tree

No. Cross-classified and multiple-membership structures occur when lower-level observations belong to several higher-level contexts.

06 · What This Means for You

Map the Hierarchy Before Choosing the Analysis

A simple decision framework

If observations naturally belong to identifiable groups
Treat the data as potentially clustered and examine whether dependence must be accounted for.
If the question concerns only lower-level relationships
You may still need methods that adjust for clustering even if higher-level effects are not substantively interpreted.
If higher-level predictors or outcomes matter
Specify the variables and hypotheses at their proper levels and consider a multilevel analytical framework.
If the same lower-level variable has both within- and between-group meaning
Separate those sources of variation rather than interpreting one pooled coefficient as though it represented both.
If observations belong to more than one higher-level unit
Consider whether a cross-classified or multiple-membership structure is more accurate than a simple hierarchy.

A useful first diagram is often simply:

What is nested within what?

That small question can prevent large analytical mistakes later.

07 · A Quick Checklist

Before Analyzing Nested or Hierarchical Data, Check This

Before choosing the statistical model, check:
What are the lowest-level observations?
What higher-level units contain or cluster those observations?
How many units are available at each level?
Are observations from the same group likely to be correlated?
What proportion of outcome variation lies between groups?
Which predictors are measured at each level?
Does the question concern within-group, between-group, or cross-level relationships?
Is treatment or exposure assigned at a different level from the outcome measurement?
Would cluster-robust, multilevel, fixed-effects, GEE, or another method best match the inferential goal?
Does the interpretation distinguish lower-level observations from higher-level independent units?
08 · Frequently Asked Questions

Frequently Asked Questions About Nested Data

What is nested data in simple terms?

Nested data occur when observations belong to identifiable higher-level groups, such as students within classrooms, employees within companies, or repeated measurements within people.

Are nested data and hierarchical data the same thing?

The terms are often used interchangeably when lower-level units belong to higher-level units. “Hierarchical” emphasizes the multiple levels, while “nested” emphasizes membership of lower-level observations within higher-level clusters.

Why are observations in the same group not independent?

They often share teachers, institutions, environments, policies, histories, or other contextual influences. These common factors can make members of the same group more similar than members of different groups.

What does the ICC tell me?

In a simple random-intercept model, the ICC summarizes how much outcome variation is associated with differences between higher-level groups and therefore how strongly observations cluster within those groups.

Do I need multilevel modeling whenever the ICC is significant?

No single significance test determines the correct analytical strategy. The choice should depend on the design, research question, number of clusters, desired estimands, degree of dependence, and assumptions of alternative methods.

Can repeated measurements be considered nested data?

Yes. Repeated observations are nested within individuals. Additional levels can exist when individuals themselves are nested within classrooms, organizations, hospitals, or other groups.

What happens if I ignore clustering?

When observations within clusters are positively correlated, treating them as independent can underestimate standard errors and produce overly precise inference. It can also blur relationships operating at different levels.

Can I have nested data without studying the higher-level groups?

Yes. Higher-level groups may matter only because they induce statistical dependence. They become substantive analytical targets only when the research question asks about group-level variation or effects.

09 · The Bottom Line

Nested Data Contain More Structure Than the Number of Rows Suggests

The Bottom Line

Nested or hierarchical data occur when lower-level observations belong to higher-level units, creating multiple sources of variation and often making observations within the same group statistically dependent.

Identify the hierarchy before analysis, distinguish lower-level from higher-level sample information, consider within-group, between-group, and cross-level relationships separately, and use a method that respects the dependence structure rather than treating every row as an unrelated case.

10 · Sources and Further Reading

Sources and Further Reading

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes