Hi,
I have used two part model for my healthcare cost data and used the following code
"twopm total_cost age i.age_grp i.sex i.comorb_cat ib2.health_insurance i.wealth_tertile i.facility1 i.level1 i.treatment1 i.flu1 ib2.sample_type_final ib2.Site, ///
firstpart(logit, nolog) secondpart(glm, family(gamma) link(log) nolog)"
but getting different number of observations in the first part, i dont understand why
I have used two part model for my healthcare cost data and used the following code
"twopm total_cost age i.age_grp i.sex i.comorb_cat ib2.health_insurance i.wealth_tertile i.facility1 i.level1 i.treatment1 i.flu1 ib2.sample_type_final ib2.Site, ///
firstpart(logit, nolog) secondpart(glm, family(gamma) link(log) nolog)"
but getting different number of observations in the first part, i dont understand why
Code:
. ta total_cost if total_cost==0
total_cost | Freq. Percent Cum.
------------+-----------------------------------
0 | 575 100.00 100.00
------------+-----------------------------------
Total | 575 100.00
. sum total_cost
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
total_cost | 3,729 974.1922 1202.411 0 19366.55
twopm total_cost age i.age_grp i.sex i.comorb_cat ib2.health_insurance i.wealth_tertile i.facility1 i.level1 i.treatment1 i.flu1
> ib2.sample_type_final ib2.Site, ///
> firstpart(logit, nolog) secondpart(glm, family(gamma) link(log) nolog)
Fitting logit regression for first part:
note: 2.level1 != 0 predicts success perfectly
2.level1 dropped and 117 obs not used
note: 3.level1 != 0 predicts success perfectly
3.level1 dropped and 53 obs not used
note: 3.treatment1 != 0 predicts success perfectly
3.treatment1 dropped and 30 obs not used
Fitting glm regression for second part:
Two-part model
------------------------------------------------------------------------------
Log pseudolikelihood = -26187.565 Number of obs = 3529
Part 1: logit
------------------------------------------------------------------------------
Number of obs = 3529
LR chi2(17) = 941.09
Prob > chi2 = 0.0000
Log likelihood = -1098.1144 Pseudo R2 = 0.3000
Part 2: glm
------------------------------------------------------------------------------
Number of obs = 3154
Deviance = 2317.199533 (1/df) Deviance = .7396104
Pearson = 2677.580772 (1/df) Pearson = .854638
Variance function: V(u) = u^2 [Gamma]
Link function : g(u) = ln(u) [Log]
AIC = 15.92292
Log likelihood = -25089.45093 BIC = -22923.59
-----------------------------------------------------------------------------------
total_cost | Coef. Std. Err. z P>|z| [95% Conf. Interval]
------------------+----------------------------------------------------------------
logit |
age | -.0057328 .0036571 -1.57 0.117 -.0129006 .0014349
|
age_grp |
65-69 | -.0207899 .1372475 -0.15 0.880 -.28979 .2482103
70 and above | .0716346 .1354971 0.53 0.597 -.1939347 .337204
|
sex |
M | -.2404908 .1097937 -2.19 0.028 -.4556825 -.025299
|
comorb_cat |
One | .1405211 .1296914 1.08 0.279 -.1136694 .3947116
More than one | .2788304 .1397698 1.99 0.046 .0048866 .5527743
|
health_insurance |
Yes | -.1972704 .1624971 -1.21 0.225 -.5157588 .1212181
|
wealth_tertile |
2 | .4299188 .1629887 2.64 0.008 .1104669 .7493707
3 | .2415955 .1526641 1.58 0.114 -.0576207 .5408117
|
facility1 |
Private | 3.134358 .6235388 5.03 0.000 1.912245 4.356472
|
level1 |
Primary | .1779982 .2299553 0.77 0.439 -.2727059 .6287023
|
treatment1 |
Ambulatory | 3.532288 .7454025 4.74 0.000 2.071326 4.99325
|
flu1 |
flu/RSV | .727569 .2962698 2.46 0.014 .1468909 1.308247
|
sample_type_final |
ALRI | .8066968 .1361144 5.93 0.000 .5399174 1.073476
|
Site |
Chennai | 1.463906 .3477832 4.21 0.000 .7822639 2.145549
Kolkata | 2.587106 .3871506 6.68 0.000 1.828305 3.345907
Pune | 1.377833 .3393943 4.06 0.000 .7126324 2.043033
|
_cons | -.1149095 .1850908 -0.62 0.535 -.4776808 .2478617
------------------+----------------------------------------------------------------
glm |
age | -.0031744 .0010904 -2.91 0.004 -.0053116 -.0010372
|
age_grp |
65-69 | -.0194222 .0405161 -0.48 0.632 -.0988323 .0599878
70 and above | .1175043 .0417505 2.81 0.005 .0356748 .1993339
|
sex |
M | .0591213 .0345553 1.71 0.087 -.0086058 .1268483
|
comorb_cat |
One | .1126224 .0449867 2.50 0.012 .02445 .2007947
More than one | .2371152 .0446565 5.31 0.000 .1495901 .3246403
|
health_insurance |
Yes | -.0276218 .0589608 -0.47 0.639 -.1431829 .0879393
|
wealth_tertile |
2 | -.0503335 .0443209 -1.14 0.256 -.1372007 .0365338
3 | -.026519 .0531616 -0.50 0.618 -.1307139 .0776758
|
facility1 |
Private | .2387775 .054445 4.39 0.000 .1320672 .3454877
|
level1 |
Primary | -.2222971 .0740025 -3.00 0.003 -.3673394 -.0772548
Secondary | -.1561688 .1202328 -1.30 0.194 -.3918207 .0794831
Tertiary | .1886037 .1490505 1.27 0.206 -.1035298 .4807372
|
treatment1 |
Ambulatory | .610182 .0699323 8.73 0.000 .4731172 .7472468
Emergency/IPD | 1.130927 .1708076 6.62 0.000 .7961499 1.465703
|
flu1 |
flu/RSV | .1072076 .0673063 1.59 0.111 -.0247104 .2391255
|
sample_type_final |
ALRI | .4263658 .037677 11.32 0.000 .3525203 .5002113
|
Site |
Chennai | .217353 .079374 2.74 0.006 .0617827 .3729232
Kolkata | -.237404 .0842827 -2.82 0.005 -.4025952 -.0722129
Pune | .0250936 .0820798 0.31 0.760 -.1357799 .1859672
|
_cons | 6.444186 .063974 100.73 0.000 6.318799 6.569573
-----------------------------------------------------------------------------------
.
end of do-file

Comment