Hi,
Today I came across something strange and I can't figure out a way to fix it, so I hope someone where can help.
I've been comparing a number of mixed models using lrtest. My syntax has worked for weeks, but after I made some updates with my sample Stata started refusing to perform the lrtest sending the following error message: "df(unrestricted) = df(restricted) = 27 r(498);"
At first I thought I had made some mistake while adding some new variables, or that my samples in some models might differ from others, but all models include the same number of groups and observations, and the error persists even when I try to compare the exact same model where there really shouldn't be any differences in df.
SYNTAX:
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1 w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl exercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
est store mm8
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1 w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl exercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
est store mm9
lrtest mm8 mm9, stats
OUTPUT:
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1
> w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl ex
> ercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
Mixed-effects ML regression Number of obs = 7,896
Group variable: idauniq Number of groups = 3,948
Obs per group:
min = 2
avg = 2.0
max = 2
Wald chi2(23) = 1173.60
Log likelihood = -19000.72 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
memory | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
omitted
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
idauniq: Unstructured |
var(time) | .1471689 . . .
var(_cons) | 10.77624 .8145419 9.292392 12.49703
cov(time,_cons) | -1.017548 . . .
-----------------------------+------------------------------------------------
var(Residual) | 4.163565 .100336 3.971482 4.364938
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 877.44 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. est store mm8
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1
> w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl ex
> ercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
Mixed-effects ML regression Number of obs = 7,896
Group variable: idauniq Number of groups = 3,948
Obs per group:
min = 2
avg = 2.0
max = 2
Wald chi2(23) = 1173.60
Log likelihood = -19000.72 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
memory | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
omitted
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
idauniq: Unstructured |
var(time) | .1471689 . . .
var(_cons) | 10.77624 .8145419 9.292392 12.49703
cov(time,_cons) | -1.017548 . . .
-----------------------------+------------------------------------------------
var(Residual) | 4.163565 .100336 3.971482 4.364938
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 877.44 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. est store mm9
. lrtest mm8 mm9, stats
df(unrestricted) = df(restricted) = 27
r(498);
.
end of do-file
Thank you!
Today I came across something strange and I can't figure out a way to fix it, so I hope someone where can help.
I've been comparing a number of mixed models using lrtest. My syntax has worked for weeks, but after I made some updates with my sample Stata started refusing to perform the lrtest sending the following error message: "df(unrestricted) = df(restricted) = 27 r(498);"
At first I thought I had made some mistake while adding some new variables, or that my samples in some models might differ from others, but all models include the same number of groups and observations, and the error persists even when I try to compare the exact same model where there really shouldn't be any differences in df.
SYNTAX:
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1 w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl exercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
est store mm8
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1 w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl exercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
est store mm9
lrtest mm8 mm9, stats
OUTPUT:
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1
> w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl ex
> ercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
Mixed-effects ML regression Number of obs = 7,896
Group variable: idauniq Number of groups = 3,948
Obs per group:
min = 2
avg = 2.0
max = 2
Wald chi2(23) = 1173.60
Log likelihood = -19000.72 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
memory | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
omitted
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
idauniq: Unstructured |
var(time) | .1471689 . . .
var(_cons) | 10.77624 .8145419 9.292392 12.49703
cov(time,_cons) | -1.017548 . . .
-----------------------------+------------------------------------------------
var(Residual) | 4.163565 .100336 3.971482 4.364938
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 877.44 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. est store mm8
mixed memory bbmi ageincl4 sex4 edu2 edu3 weal2 weal3 limitil4 hepsyde4 w4pacomb1
> w4alco1 time bmisl ageincl4sl sexsl medusl hedusl measl heasl illnessl depressl ex
> ercisesl alcoholsl|| id:time, cov(unstr) var nolog || if covars ==1
Mixed-effects ML regression Number of obs = 7,896
Group variable: idauniq Number of groups = 3,948
Obs per group:
min = 2
avg = 2.0
max = 2
Wald chi2(23) = 1173.60
Log likelihood = -19000.72 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
memory | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
omitted
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
idauniq: Unstructured |
var(time) | .1471689 . . .
var(_cons) | 10.77624 .8145419 9.292392 12.49703
cov(time,_cons) | -1.017548 . . .
-----------------------------+------------------------------------------------
var(Residual) | 4.163565 .100336 3.971482 4.364938
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 877.44 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. est store mm9
. lrtest mm8 mm9, stats
df(unrestricted) = df(restricted) = 27
r(498);
.
end of do-file
Thank you!
Comment