Hello all,
I am using melogit in Stata 14.2. In the following I use an example, which is based on example 3, section on meqrlogit, page 261 in the Stata multilevel mixed-effects reference manual, release 14 (https://www.stata.com/manuals14/me.pdf). Thus, I am using the Bangladesh fertility survey, with binary variable c_use as independent variable, urban as one covariate in the fixed part, and district in the random part of the model. As I am interested whether the size of district effects is different for rural and urban areas, I introduce separate random effects, within each district, for the urban and rural areas of that district.
Now I want to know whether the difference in size of district effects is significantly different for rural and urban areas. As rule of thumb I was looking at the overlap of the confidence intervals of the variance components. Nevertheless, I would prefer using a test of difference. I came up with the Wald test (test) or the linear combination test (lincom). However, neither do I know whether these tests are appropriate nor am I able to implement the tests. I tried several functions to assess the estimates correctly, but Stata did not find the equations. I hope somebody has a solution for my problem.
Thanks in advance!
Jessica
And here my output
I am using melogit in Stata 14.2. In the following I use an example, which is based on example 3, section on meqrlogit, page 261 in the Stata multilevel mixed-effects reference manual, release 14 (https://www.stata.com/manuals14/me.pdf). Thus, I am using the Bangladesh fertility survey, with binary variable c_use as independent variable, urban as one covariate in the fixed part, and district in the random part of the model. As I am interested whether the size of district effects is different for rural and urban areas, I introduce separate random effects, within each district, for the urban and rural areas of that district.
Now I want to know whether the difference in size of district effects is significantly different for rural and urban areas. As rule of thumb I was looking at the overlap of the confidence intervals of the variance components. Nevertheless, I would prefer using a test of difference. I came up with the Wald test (test) or the linear combination test (lincom). However, neither do I know whether these tests are appropriate nor am I able to implement the tests. I tried several functions to assess the estimates correctly, but Stata did not find the equations. I hope somebody has a solution for my problem.
Thanks in advance!
Jessica
Code:
use http://www.stata-press.com/data/r13/bangladesh *Coding the dummy for the random slope generate byte rural = 1 - urban **Fixed part: contrast coding; Random part: separate coding melogit c_use urban age child*, noconstant || district: rural urban, noconstant cov(unstr) *Assessing mat list e(b) *Wald test test (_b[var(rural~):_cons])=(_b[var(urban~):_cons])
Code:
. use http://www.stata-press.com/data/r13/bangladesh
(Bangladesh Fertility Survey, 1989)
.
. *Coding the dummy for the slope
. generate byte rural = 1 - urban
.
. **Fixed part: contrast coding; Random part: separate coding
. melogit c_use urban age child*, noconstant || district: rural urban, noconstant cov(unstr)
Fitting fixed-effects model:
Iteration 0: log likelihood = -1319.0486
Iteration 1: log likelihood = -1318.2334
Iteration 2: log likelihood = -1318.2333
Refining starting values:
Grid node 0: log likelihood = -1281.9182
Fitting full model:
Iteration 0: log likelihood = -1281.9182 (not concave)
Iteration 1: log likelihood = -1278.7665
Iteration 2: log likelihood = -1255.4999
Iteration 3: log likelihood = -1243.247
Iteration 4: log likelihood = -1242.2767
Iteration 5: log likelihood = -1242.1427
Iteration 6: log likelihood = -1242.1407
Iteration 7: log likelihood = -1242.1407
Mixed-effects logistic regression Number of obs = 1,934
Group variable: district Number of groups = 60
Obs per group:
min = 2
avg = 32.2
max = 118
Integration method: mvaghermite Integration pts. = 7
Wald chi2(5) = 35.37
Log likelihood = -1242.1407 Prob > chi2 = 0.0000
( 1) [c_use]_cons = 0
---------------------------------------------------------------------------------
c_use | Coef. Std. Err. z P>|z| [95% Conf. Interval]
----------------+----------------------------------------------------------------
urban | -.7432387 .2431403 -3.06 0.002 -1.219785 -.2666925
age | -.0129732 .0081923 -1.58 0.113 -.0290298 .0030833
child1 | .7860069 .1653889 4.75 0.000 .4618505 1.110163
child2 | .9398673 .1839723 5.11 0.000 .5792882 1.300446
child3 | .8591355 .1929315 4.45 0.000 .4809967 1.237274
_cons | 0 (omitted)
----------------+----------------------------------------------------------------
district |
var(rural)| 2.604838 .7142998 1.521822 4.45859
var(urban)| .2849728 .1908777 .0766761 1.059125
----------------+----------------------------------------------------------------
district |
cov(urban,rural)| -.3807802 .4236954 -0.90 0.369 -1.211208 .4496474
---------------------------------------------------------------------------------
LR test vs. logistic model: chi2(3) = 152.19 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
.
. *Assessing
. mat list e(b)
e(b)[1,9]
c_use: c_use: c_use: c_use: c_use: c_use: var(rural~): var(urban~): cov(urban~i:
urban age child1 child2 child3 _cons _cons _cons _cons
y1 -.74323873 -.01297323 .78600689 .9398673 .85913554 0 2.6048377 .28497281 -.38078023
.
. *Wald test
. test (_b[var(rural~):_cons])=(_b[var(urban~):_cons])
equation var(rural~) not found

Comment