# LoadError: ArgumentError: LR test is only valid for nested models

**URL:** <https://discourse.julialang.org/t/loaderror-argumenterror-lr-test-is-only-valid-for-nested-models/140108>\
**Category:** New to Julia\
**Created:** [October 19, 2026, 10:03pm UTC](https://discourse.julialang.org/t/loaderror-argumenterror-lr-test-is-only-valid-for-nested-models/140108 "2026-10-19T22:03:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marNikifo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marnikifo/32/224752_2.png) [@marNikifo](https://discourse.julialang.org/u/marNikifo)\
**Post date:** [October 19, 2026, 10:03pm UTC](https://discourse.julialang.org/t/loaderror-argumenterror-lr-test-is-only-valid-for-nested-models/140108/1 "2026-10-19T22:03:10Z")

</div>

Hello! I’m trying to follow along with the “Multilevel Models in Julia” tutorial by Yichi Zhang (I can’t include a link, but it’s publicly available) using my own data. In this exercise, you implement a random intercepts model (mm1), one with only the level-2 predictor (mm2), one with only the level-1 predictor (mm3), and then one with a cross-level interaction (mm4). I was able to do all of that successfully, but when I try to call **MixedModels.likelihoodratiotest(mm1,mm2,mm3,mm4)** I get the following error:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/0/00716b1fbb99a46a200542e9406ba6e9b4614535.png)

Through trial and error, I’ve found that the likelihood ratio test _will_ run successfully if I exclude mm3, which (as in the tutorial) has just the level-1 variables. I’m a little confused as to why it’s causing an error when mm4 has those variables in it as well. Does anyone have an inkling as to what I might be doing wrong here?
