I would greatly appreciate advice about the best way to calculate the overall ratio and its 95% CI (not the difference) for a categorical variable with values 0 or 1 in zero-inflated Poisson regression (zip) in Stata/IC 16.1. For example, in the fishing dataset, calculate the overall ratio and its 95% CI for the number of fish caught for camper=1 / camper=0 given that campers who go fishing catch more fish than non-campers who go fishing (count model) and campers are more likely to go fishing than non-campers (inflate model):
Code:
use https://www.stata-press.com/data/r16/fish zip count persons child i.camper i.livebait, /// inflate(persons child i.camper i.livebait) vce(robust) irr nolog Zero-inflated Poisson regression Number of obs = 250 Nonzero obs = 108 Zero obs = 142 Inflation model = logit Wald chi2(4) = 31.53 Log pseudolikelihood = -712.4109 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ | Robust count | IRR Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- count | persons | 2.307947 .4018602 4.80 0.000 1.640645 3.246663 child | .3070827 .1140441 -3.18 0.001 .1482986 .6358779 1.camper | 1.816776 .6923589 1.57 0.117 .860826 3.834313 1.livebait | 6.164537 2.812036 3.99 0.000 2.521236 15.07258 _cons | .0861211 .0717259 -2.94 0.003 .016834 .4405871 -------------+---------------------------------------------------------------- inflate | persons | -.9311615 .2235628 -4.17 0.000 -1.369337 -.4929864 child | 1.958577 .3640051 5.38 0.000 1.24514 2.672014 1.camper | -.8716704 .4055473 -2.15 0.032 -1.666529 -.0768123 1.livebait | .7407971 1.512794 0.49 0.624 -2.224225 3.705819 _cons | .8337162 1.751823 0.48 0.634 -2.599794 4.267227 ------------------------------------------------------------------------------ Note: Estimates are transformed only in the first equation. Note: _cons estimates baseline incidence rate. . mchange camper, stat(all) zip: Changes in mu | Number of obs = 250 Expression: Predicted number of count, predict() | Change p-value LL UL z-value Std Err From To -------+------------------------------------------------------- camper | 1 vs 0 | 2.153 0.022 0.314 3.991 2.295 0.938 1.840 3.993 Average prediction: 3.230 . * Ratio camper/non-camper . di 3.993/1.840 = 2.1701087 . * Lower 95% CI . di (1.840 + 0.314)/1.840 = 1.1706522 . * Upper 95% CI . di (1.840 + 3.991)/1.840 = 3.1690217 . margins camper, post Predictive margins, Number of obs = 250, Model VCE : Robust Expression: Predicted number of events, predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- camper | 0 | 1.839983 .518668 3.55 0.000 .8234123 2.856553 1 | 3.992508 .8026569 4.97 0.000 2.41933 5.565687 ------------------------------------------------------------------------------ . nlcom (Ratio: _b[1.camper] / _b[0.camper]) risk_ratio: _b[1.camper] / _b[0.camper] ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- Ratio | 2.169862 .7368881 2.94 0.003 .7255876 3.614136 -------------------------------------------------------------------------------
The Stata Base Reference Manual Release 16 entry for nlcom on page 1721 (Technical note) says in part, ‘The test of H0 : exp(β) = 1 is asymptotically equivalent to a test of H0 : β = 0, the Wald test in the original metric, but the latter has better small-sample properties. Thus if you specify eform, you get a test of H0 : β = 0. nlcom, however, is general. It does not attempt to infer the test of greatest interest for a given transformation, and so a test of H0 : transformed coefficient = 0 is always given, regardless of the transformation.’
1. The Reference Manual entry suggests that the mchange estimate may be better than the nlcom estimate. Is that correct?
2. What is the best way to calculate the 95% CI of the ratio of campers/non-campers?
0 Response to Zero-inflated Poisson: ratio (95% CI) for a 0,1 variable
Post a Comment