Dear all,
I'm trying to replicate some "margins" command results using the option "over" after a svy poisson model.
My outcome is a binary variable "Y" which assumes values 0 or 1.
I ran the model and then I asked for margins over a dummie variable (heavy_dummie) and age_group (idade_4f)
After that I tried to replicate the results calculating the average predicted count over groups.
Note that, for example, the average prediction for group where heavy_dummie=0 and idade_4f=3 (0.679) is not the same value presented in margins output of the same group (0.717).
I can't see what I'm doing wrong. Could you help me please?
Here is the output:
svyset UPA_PNS [pweight=V00291], strata(v0024n) vce(linearized) singleunit(centered)
svy linearized, subpop(if domain==1 & idade_4f!=4 & sexo_dummie==1) : poisson Y ib3.idade_4f##i.heavy_dummie i.cor_dummie i.grupos_estcivil ib3.nivel_instr i.v0026n, irr
. margins , over( idade_4f heavy_dummie) vce(unconditional) subpop(if domain==1 & idade_4f!=4 & sexo_dummie==1)
Predictive margins Number of obs = 90,846
Subpop. no. obs = 27,471
Expression : Predicted number of events, predict()
over : idade_4f heavy_dummie
---------------------------------------------------------------------------------------
| Linearized
| Margin Std. Err. t P>|t| [95% Conf. Interval]
----------------------+----------------------------------------------------------------
idade_4f#heavy_dummie |
1 0 | .2469603 .01412 17.49 0.000 .2192811 .2746396
1 1 | .3802284 .049648 7.66 0.000 .2829042 .4775526
2 0 | .5449628 .0096616 56.41 0.000 .5260234 .5639022
2 1 | .5816247 .0229121 25.39 0.000 .5367104 .6265389
3 0 | .7169113 .0070071 102.31 0.000 .7031754 .7306471
3 1 | .6917288 .0269397 25.68 0.000 .6389194 .7445381
---------------------------------------------------------------------------------------
predict test
. mean test if domain==1 & idade_4f==3 & sexo_dummie==1, over( idade_4f heavy_dummie)
Mean estimation Number of obs = 13,245
Over: idade_4f heavy_dummie
_subpop_1: 3 0
_subpop_2: 3 1
--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
test |
_subpop_1 | .6792949 .0019595 .6754539 .6831358
_subpop_2 | .6421874 .0069991 .6284682 .6559066
--------------------------------------------------------------
I'm trying to replicate some "margins" command results using the option "over" after a svy poisson model.
My outcome is a binary variable "Y" which assumes values 0 or 1.
I ran the model and then I asked for margins over a dummie variable (heavy_dummie) and age_group (idade_4f)
After that I tried to replicate the results calculating the average predicted count over groups.
Note that, for example, the average prediction for group where heavy_dummie=0 and idade_4f=3 (0.679) is not the same value presented in margins output of the same group (0.717).
I can't see what I'm doing wrong. Could you help me please?
Here is the output:
svyset UPA_PNS [pweight=V00291], strata(v0024n) vce(linearized) singleunit(centered)
svy linearized, subpop(if domain==1 & idade_4f!=4 & sexo_dummie==1) : poisson Y ib3.idade_4f##i.heavy_dummie i.cor_dummie i.grupos_estcivil ib3.nivel_instr i.v0026n, irr
. margins , over( idade_4f heavy_dummie) vce(unconditional) subpop(if domain==1 & idade_4f!=4 & sexo_dummie==1)
Predictive margins Number of obs = 90,846
Subpop. no. obs = 27,471
Expression : Predicted number of events, predict()
over : idade_4f heavy_dummie
---------------------------------------------------------------------------------------
| Linearized
| Margin Std. Err. t P>|t| [95% Conf. Interval]
----------------------+----------------------------------------------------------------
idade_4f#heavy_dummie |
1 0 | .2469603 .01412 17.49 0.000 .2192811 .2746396
1 1 | .3802284 .049648 7.66 0.000 .2829042 .4775526
2 0 | .5449628 .0096616 56.41 0.000 .5260234 .5639022
2 1 | .5816247 .0229121 25.39 0.000 .5367104 .6265389
3 0 | .7169113 .0070071 102.31 0.000 .7031754 .7306471
3 1 | .6917288 .0269397 25.68 0.000 .6389194 .7445381
---------------------------------------------------------------------------------------
predict test
. mean test if domain==1 & idade_4f==3 & sexo_dummie==1, over( idade_4f heavy_dummie)
Mean estimation Number of obs = 13,245
Over: idade_4f heavy_dummie
_subpop_1: 3 0
_subpop_2: 3 1
--------------------------------------------------------------
Over | Mean Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
test |
_subpop_1 | .6792949 .0019595 .6754539 .6831358
_subpop_2 | .6421874 .0069991 .6284682 .6559066
--------------------------------------------------------------
Comment