I am interested to calculate predicted mean expenditures by condition group (conditions 1-4). The outcome is total expenditures including some 0 values, so I fit the two-part model. Main interest is to use margins to estimate predicted mean for each condition category. One of the conditions (condition 3) has 0 (no) observations with 0 expenditures and that is why the logit model coefficient is 0, and no predicted margin was calculated for condition 3. Can I still use the twopm, or any suggestions for this situation since the main interest is predicted mean for conditions?
svy: twopm TOTEXP22 i.diag2 if exclusion==1, firstpart(logit, nolog) secondpart(glm, family(gamma) link(log) nolog)
(running twopm on estimation sample)
Survey data analysis
Number of strata = 105 Number of obs = 4,023
Number of PSUs = 348 Population size = 49,972,532
Design df = 243
F(2, 242) = 5.23
Prob > F = 0.0059
------------------------------------------------------------------------------
| Linearized
TOTEXP22 | Coefficient std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
logit |
diag2 |
condition2 | -.2460358 .2919973 -0.84 0.400 -.8212046 .329133
condition3 | 0 (empty)
condition4 | 1.22004 .4498981 2.71 0.007 .3338425 2.106238
|
_cons | 3.447114 .1897759 18.16 0.000 3.073298 3.820929
-------------+----------------------------------------------------------------
glm |
diag2 |
condition2 | .1630623 .0944394 1.73 0.086 -.0229621 .3490866
condition3 | .8484066 .051607 16.44 0.000 .7467524 .9500608
condition4 | .6767057 .0865197 7.82 0.000 .5062814 .8471299
|
_cons | 9.467698 .051607 183.46 0.000 9.366044 9.569353
------------------------------------------------------------------------------
. margins i.diag2
Adjusted predictions
Number of strata = 105 Number of obs = 4,023
Number of PSUs = 348 Population size = 49,972,532
Subpop. no. obs = 3,973
Subpop. size = .
Model VCE: Linearized Design df = 243
Expression: twopm combined expected values, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
diag2 |
condition1 | 12535.97 661.786 18.94 0.000 11232.4 13839.54
condition2 | 14630.29 1188.604 12.31 0.000 12289.01 16971.57
condition4 | 25211.33 1478.899 17.05 0.000 22298.24 28124.43
------------------------------------------------------------------------------
svy: twopm TOTEXP22 i.diag2 if exclusion==1, firstpart(logit, nolog) secondpart(glm, family(gamma) link(log) nolog)
(running twopm on estimation sample)
Survey data analysis
Number of strata = 105 Number of obs = 4,023
Number of PSUs = 348 Population size = 49,972,532
Design df = 243
F(2, 242) = 5.23
Prob > F = 0.0059
------------------------------------------------------------------------------
| Linearized
TOTEXP22 | Coefficient std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
logit |
diag2 |
condition2 | -.2460358 .2919973 -0.84 0.400 -.8212046 .329133
condition3 | 0 (empty)
condition4 | 1.22004 .4498981 2.71 0.007 .3338425 2.106238
|
_cons | 3.447114 .1897759 18.16 0.000 3.073298 3.820929
-------------+----------------------------------------------------------------
glm |
diag2 |
condition2 | .1630623 .0944394 1.73 0.086 -.0229621 .3490866
condition3 | .8484066 .051607 16.44 0.000 .7467524 .9500608
condition4 | .6767057 .0865197 7.82 0.000 .5062814 .8471299
|
_cons | 9.467698 .051607 183.46 0.000 9.366044 9.569353
------------------------------------------------------------------------------
. margins i.diag2
Adjusted predictions
Number of strata = 105 Number of obs = 4,023
Number of PSUs = 348 Population size = 49,972,532
Subpop. no. obs = 3,973
Subpop. size = .
Model VCE: Linearized Design df = 243
Expression: twopm combined expected values, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
diag2 |
condition1 | 12535.97 661.786 18.94 0.000 11232.4 13839.54
condition2 | 14630.29 1188.604 12.31 0.000 12289.01 16971.57
condition4 | 25211.33 1478.899 17.05 0.000 22298.24 28124.43
------------------------------------------------------------------------------

Comment