Hi all
I have a question regarding an error message after running a likelihood ratio test (LRT). We are building multilevel models and testing each model with the previous with the intention to retain the most parsimonious model. We are using the lrtest command to assess the model fit. I think the issue is with the code but any advice is greatly appreciated. Below are the details.

We have a standardized continuous dependent variable (weight) and a binary (0,1) independent variable (smoke) - these are our level 1 variables. The level 2 variable is geographic region (geo).
We have three models and we would like to test Model1 vs Model2 and Model2 vs Model3.

Model1. Null model
Code:
mixed weight || geo:
Model2. Random intercept
Code:
 mixed weight i.smoke|| geo:
Model3. Random coefficient
Code:
mixed weight i.smoke|| geo: R.smoke
We tested Model1 vs Model2 using the lrtest command and a result was output (code below).
Code:
mixed weight || geo:, nolog
est store null

mixed weight i.smoke|| geo:, nolog
est store ri_smoke
lrtest ri_smoke null
However, when we tested Model2 vs Model3 (code below) we get the following error message.

df(unrestricted) = df(restricted) = 4


Code:
mixed weight i.smoke|| geo: R.smoke, nolog
est store rc_smoke
lrtest rc_smoke ri_smoke
The mixed command delivers an output, but the lrtest command is producing the error message. I appreciate for nesting to occur the df needs to be larger in Model3. However as we have added an extra parameter into the model (random coefficient) my understanding is the df for Model3 is larger than Model2 and Model 2 is thus nested in Model 3. This makes me think it might be the code for the binary IV. Any advice is greatly appreciated!


I am using Stata 16.

Thanks in advance for your time.
Jen