Dear Statalist, I am doing a multilevel model with a regional panel dataset (region-year obs). Since my dep variable is a count, I am using a poisson/negative binomial models with random intercepts and coefficient. The idea is to study if the effect of the main indep variable is different for different regions.
My first problem is with the estimation. If I use a negative binomial model the parameter is significant, but the random coefficient is not (from a visual interpretation since the random coefficient and its standard error are tiny – see below the estimation from “menbreg” ). However, if I redo the same model, this time using a poisson model with GLLAMM, the coefficient is not significant, but the random part it is (which I interpret that on average there is no effect of the independent variable, but it could be that some regions have a positive and significant effect since the random coefficient seems to be significant). Because of that, I would like to make a graph of the coefficient, but for each region (274 in total), which I believe would imply using the coefficient itself plus the estimation for each region random effect. Just to visually check my hypothesis.
Is it possible to do this with the GLLAMM and the menbreg command to compare both graph? Can you help me with this?
Another less important issue is that the same model is slightly different (main indep variable coefficient and standard error) from the GLLAMM poisson command than from “mepoisson”. See the results below for the “menbreg”, GLLAMM, and “mepoisson” to check. Maybe I am doing something different, but do not see what. Is this normal?
I also include an example of the data below for if it helps.
Thanks for your help in advance.
My first problem is with the estimation. If I use a negative binomial model the parameter is significant, but the random coefficient is not (from a visual interpretation since the random coefficient and its standard error are tiny – see below the estimation from “menbreg” ). However, if I redo the same model, this time using a poisson model with GLLAMM, the coefficient is not significant, but the random part it is (which I interpret that on average there is no effect of the independent variable, but it could be that some regions have a positive and significant effect since the random coefficient seems to be significant). Because of that, I would like to make a graph of the coefficient, but for each region (274 in total), which I believe would imply using the coefficient itself plus the estimation for each region random effect. Just to visually check my hypothesis.
Is it possible to do this with the GLLAMM and the menbreg command to compare both graph? Can you help me with this?
Another less important issue is that the same model is slightly different (main indep variable coefficient and standard error) from the GLLAMM poisson command than from “mepoisson”. See the results below for the “menbreg”, GLLAMM, and “mepoisson” to check. Maybe I am doing something different, but do not see what. Is this normal?
I also include an example of the data below for if it helps.
Thanks for your help in advance.
Code:
menbreg y1 L5.c.x1 i.year if year<=2022 || id: L5.c.x1 , vce(robust) eform
Code:
Mixed-effects nbinomial regression Number of obs = 3,288 Overdispersion: mean Group variable: id Number of groups = 274 Obs per group: min = 12 avg = 12.0 max = 12 Integration method: mvaghermite Integration pts. = 7 Wald chi2(12) = 64.75 Log pseudolikelihood = -10922.383 Prob > chi2 = 0.0000 (Std. Err. adjusted for 274 clusters in id) ------------------------------------------------------------------------------ | Robust y1 | exp(b) Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | L5. | 1.028907 .0147667 1.99 0.047 1.000368 1.05826 | year | 2006 | 1 (empty) 2007 | 1 (empty) 2008 | 1 (empty) 2009 | 1 (empty) 2010 | 1 (empty) 2011 | .9119078 .0344727 -2.44 0.015 .8467849 .982039 2012 | .9894641 .0338078 -0.31 0.757 .925372 1.057995 2013 | 1.025426 .0316322 0.81 0.416 .9652655 1.089337 2014 | 1.006971 .030441 0.23 0.818 .9490412 1.068438 2015 | .9904435 .0273633 -0.35 0.728 .9382385 1.045553 2016 | .967458 .0277543 -1.15 0.249 .9145616 1.023414 2017 | .9405029 .0270033 -2.14 0.033 .889039 .9949458 2018 | .9948799 .0277803 -0.18 0.854 .9418946 1.050846 2019 | 1.010921 .0257702 0.43 0.670 .9616529 1.062712 2020 | 1.030888 .0231985 1.35 0.176 .9864079 1.077374 2021 | 1.025108 .0183955 1.38 0.167 .9896797 1.061804 2022 | 1 (omitted) | _cons | 14.59819 1.620518 24.15 0.000 11.7438 18.14635 -------------+---------------------------------------------------------------- /lnalpha | -3.470395 .1139376 -3.693708 -3.247081 -------------+---------------------------------------------------------------- id | var(L5.x1)| 9.39e-37 4.39e-35 1.63e-76 5396.854 var(_cons)| 3.238494 .3348332 2.644454 3.965978 ------------------------------------------------------------------------------
Code:
gllamm y1 L5x1 year6-year16, i(id) family(poisson) link(log) nrf(2) eq(inter slope) eform adapt nip(15 15) cluster(id)
Code:
number of level 1 units = 3288 number of level 2 units = 274 Condition Number = 12.315206 gllamm model log likelihood = -11301.293 Robust standard errors for clustered data: cluster(id) ---------------------------------------------------------------------------------------- y1 | exp(b) Std. Err. z P>|z| [95% Conf. Interval] -----------------------+---------------------------------------------------------------- L5x1 | 1.022388 .0252052 0.90 0.369 .9741609 1.073002 year6 | .8245291 .0430724 -3.69 0.000 .7442867 .9134225 year7 | .9245136 .0419246 -1.73 0.083 .8458888 1.010447 year8 | .966416 .0449236 -0.73 0.462 .8822594 1.0586 year9 | .9527646 .039601 -1.16 0.244 .8782254 1.03363 year10 | .9471477 .0341022 -1.51 0.132 .8826125 1.016402 year11 | .9249721 .0342073 -2.11 0.035 .8602993 .9945068 year12 | .8964757 .0316301 -3.10 0.002 .8365768 .9606633 year13 | .9199161 .0324448 -2.37 0.018 .8584735 .9857562 year14 | .9663046 .0378807 -0.87 0.382 .8948403 1.043476 year15 | 1.013463 .0269093 0.50 0.614 .9620709 1.067601 year16 | 1.002321 .0176545 0.13 0.895 .9683096 1.037528 _cons | 15.23028 1.74463 23.77 0.000 12.16753 19.06396 ---------------------------------------------------------------------------------------- Note: Estimates are transformed only in the first equation. Variances and covariances of random effects ------------------------------------------------------------------------------ ***level 2 (id) var(1): 3.1587211 (.33311119) cov(2,1): -.08200452 (.03828723) cor(2,1): -.24904404 var(2): .03432512 (.00608759) ------------------------------------------------------------------------------
Code:
mepoisson y1 L5.c.x1 i.year if year<=2022 || id: L5.c.x1 , vce(robust) eform
Code:
Mixed-effects Poisson regression Number of obs = 3,288 Group variable: id Number of groups = 274 Obs per group: min = 12 avg = 12.0 max = 12 Integration method: mvaghermite Integration pts. = 7 Wald chi2(12) = 91.69 Log pseudolikelihood = -11301.512 Prob > chi2 = 0.0000 (Std. Err. adjusted for 274 clusters in id) ------------------------------------------------------------------------------ | Robust y1 | exp(b) Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | L5. | .9986708 .0221158 -0.06 0.952 .9562519 1.042971 | year | 2006 | 1 (empty) 2007 | 1 (empty) 2008 | 1 (empty) 2009 | 1 (empty) 2010 | 1 (empty) 2011 | .8269095 .0433115 -3.63 0.000 .7462325 .9163087 2012 | .9266356 .0422601 -1.67 0.095 .8474013 1.013279 2013 | .9683979 .0452809 -0.69 0.492 .8835942 1.061341 2014 | .9543322 .0398591 -1.12 0.263 .879322 1.035741 2015 | .94837 .0343184 -1.46 0.143 .883437 1.018076 2016 | .9263578 .0344053 -2.06 0.039 .8613206 .9963059 2017 | .8976381 .0317488 -3.05 0.002 .8375194 .9620722 2018 | .9211994 .0325613 -2.32 0.020 .859541 .9872809 2019 | .9674635 .0380058 -0.84 0.400 .8957689 1.044896 2020 | 1.014135 .0269662 0.53 0.598 .9626357 1.068389 2021 | 1.002216 .0176661 0.13 0.900 .9681825 1.037446 2022 | 1 (omitted) | _cons | 15.23259 1.725934 24.04 0.000 12.19911 19.0204 -------------+---------------------------------------------------------------- id | var(L5.x1)| .0322669 .0055729 .0230008 .045266 var(_cons)| 3.226455 .3347703 2.632732 3.954071 ------------------------------------------------------------------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id int year float(y1 x1) 1 2006 5 -1.7775646 1 2007 5 -1.2202544 1 2008 8 -.7455087 1 2009 9 -.8487142 1 2010 9 -.807432 1 2011 7 -.0849928 1 2012 9 .1420595 1 2013 11 -.642303 1 2014 12 -.1881984 1 2015 7 -.06435169 1 2016 8 .05949503 1 2017 4 .03885391 1 2018 9 .7819343 1 2019 10 .4103941 1 2020 13 1.6695024 1 2021 9 1.6695024 1 2022 6 1.607579 2 2006 20 -1.9668324 2 2007 29 -.6613229 2 2008 36 -.5426402 2 2009 35 .849184 2 2010 41 -.2297495 2 2011 52 -.05712012 2 2012 39 .09393056 2 2013 58 -.58579755 2 2014 55 -.2297495 2 2015 57 -.5642189 2 2016 56 -.1758028 2 2017 49 -.29448548 2 2018 59 -.9094776 2 2019 71 .3852426 2 2020 51 .9678667 2 2021 64 1.658384 2 2022 57 2.2625868 3 2006 22 -1.461945 3 2007 26 -.7937856 3 2008 25 -.5662836 3 2009 35 -.3920703 3 2010 38 -.5990766 3 2011 44 -.6298202 3 2012 50 -.4720034 3 2013 63 -.6195723 3 2014 54 -.6072749 3 2015 59 -.6031758 3 2016 56 -.1502212 3 2017 56 .11417311 3 2018 54 .6593583 3 2019 72 1.040578 3 2020 76 1.1901965 3 2021 51 1.69644 3 2022 53 2.194485 4 2006 4 -1.5086967 4 2007 10 -.6170927 4 2008 9 -.636063 4 2009 16 -.7878254 4 2010 18 -.10489471 4 2011 29 -.7688551 4 2012 30 -.010043235 4 2013 17 -.5791521 4 2014 20 -.4843006 4 2015 11 .008927062 4 2016 16 -.3515086 4 2017 18 .2365706 4 2018 19 -.44636005 4 2019 21 .4452439 4 2020 21 2.11463 4 2021 21 1.678313 4 2022 17 1.8111053 5 2006 31 -1.749826 5 2007 24 -1.010769 5 2008 32 -.5142152 5 2009 40 -.12159124 5 2010 39 -.6527883 5 2011 42 -.6758839 5 2012 66 -.21397334 5 2013 90 -.768266 5 2014 85 -.2255211 5 2015 50 -.23706888 5 2016 58 .59437007 5 2017 63 -.39873755 5 2018 83 .05162521 5 2019 80 .744491 5 2020 90 1.67986 5 2021 82 1.772242 5 2022 64 1.726051 end
Comment