What Are Nested Models?

by Karen Grace-Martin


Pretty much all of the common statistical models we use, with the exception of OLS Linear Models, use Maximum Likelihood estimation.

This includes favorites like:

That’s a lot of models.

If you’ve ever learned any of these, you’ve heard that some of the statistics that compare model fit in competing models require that models be nested (specifically, the likelihood ratio test, based on model deviance). This is particularly important while you’re trying to do model building. You need to know which model fits better.

This can get really confusing because we often talk about variables being nested. For example, you may hear:

  • Plot of trees is nested within Treatment
  • Students are nested within Teacher
  • Transects are nested within Location
  • Word is nested within List

While this concept of nesting is the same as the one we’re applying to models, it’s a different application of the concept.

Nested Models

So what are we talking about when we talk about nested models?

Model A is nested in Model B if the parameters in Model A are a subset of the parameters in Model B.

That’s it.

Let’s look at an example.

We are predicting the Height of a shrub from the bacteria in the soil, which is measured continuously, and by the dummy-coded variable Sun, which has a value of 1 for a location in full sun and a value=0 for a location in partial sun.

Model A:  Heighti = β0 + β1*Bacteria + β2*Sun + β3*Bacteria*Sun + εi

This model has five parameters: β0 , β1 , β2 , β3 are all obvious, but there is one more, usually stated as an afterthought:  σ2

σ2 is the variance of the errors, εi. Sometimes you’ll see this written after the model, to make sure that this parameter and model assumptions are directly stated:

εi ~ i.i.d. N(0, σ2)

In your output you’ll see estimates of all 5 parameters. The four regression coefficients will usually be in one table and the residual variance is often in another. But they’re all there.

Okay, so let’s compare this model to one in which we add a few covariates:

Model B:  Heighti = β0 + β1*Bacteria + β2*Sun + β3*Bacteria*Sun + β4*Soil Nitrogen level + β5*Plant density + εi

However, let’s consider a third model. Say we realized there was no real interaction between Soil Bacteria and Sun so we remove it to get Model C.

Model C:  Heighti = β0 + β1*Bacteria + β2*Sun + β4*Soil Nitrogen level + β5*Plant density + εi

Model A had 5 parameters:  β0, β1, β2, β3, and σ2

Model B has 7:  β0, β1, β2, β3, β4, β5, and σ2

Model C has 6:  β0, β1, β2, β4, β5, and σ2

So Model A is nested in Model B.

Model C is nested in Model B.

But C and A are not nested. Each one contains parameters that the other doesn’t.

I’ve shown this example with fixed effects parameters — the regression coefficients, but it works the same way when we compare models with different variance or covariance parameters, as occurs when we add random or repeated effects.

Interested in learning more? Check out our free webinar recording, Random Intercept and Random Slope Models: An Introduction to Mixed Models.

Leave a Comment

Please note that Karen receives hundreds of comments at The Analysis Factor website each week. Since Karen is also busy teaching workshops, consulting with clients, and running a membership program, she seldom has time to respond to these comments anymore. If you have a question to which you need a timely response, please check out our low-cost monthly membership program, or sign-up for a quick question consultation.

Previous post:

Next post: