Yesterday, I sent a message to the list saying:
=========================================================================
Below is (version 9.2) output from the -zinb- program using the example
data from the manual. In this data, "count" is the number of fish caught
by visitors to a national park and "persons", "livebait", "child" and
"camper" are covariates.
. use http://www.stata-press.com/data/r9/fish
. zinb count persons livebait, inflate(child camper) nolog
Zero-inflated negative binomial regression Number of obs = 250
Nonzero obs = 108
Zero obs = 142
Inflation model = logit LR chi2(2) = 82.23
Log likelihood = -401.5478 Prob > chi2 = 0.0000
------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------+--------------------------------------------------------------
count |
persons | .9742984 .1034938 9.41 0.000 .7714543 1.177142
livebait | 1.557523 .4124424 3.78 0.000 .7491503 2.365895
_cons | -2.730064 .476953 -5.72 0.000 -3.664874 -1.795253
---------+--------------------------------------------------------------
inflate |
child | 3.185999 .7468551 4.27 0.000 1.72219 4.649808
camper | -2.020951 .872054 -2.32 0.020 -3.730146 -.3117567
_cons | -2.695385 .8929071 -3.02 0.003 -4.44545 -.9453189
---------+--------------------------------------------------------------
/lnalpha | .5110429 .1816816 2.81 0.005 .1549535 .8671323
---------+--------------------------------------------------------------
alpha | 1.667029 .3028685 1.167604 2.380076
------------------------------------------------------------------------
After fitting the model, one can use the -predict- command to generate
the predicted number of events (ie., the number of fish caught):
. predict pn
This works fine, however, to verify I understand what the model really is,
I'm trying to manually calculate the predicted number of events from the
values of the variables and the model coefficients.
So far, I'm failing miserably!
Can anyone suggest how to use these coefficients to manually generate
predicted # of events?
=========================================================================
Resting my tired brain overnight let me see past the block I had formed
and I'm now able to manually generate the predicted counts.
For anyone interested, I'll explain below.
First, note that if one lists the coefficient matrix, e(b), it shows the
coefficients are stored as follows:
. matrix list e(b)
e(b)[1,7]
count: count: count: inflate: inflate: inflate: lnalpha:
persons livebait _cons child camper _cons _cons
y1 .97429837 1.5575226 -2.7300635 3.1859991 -2.0209512 -2.6953847 ..51104289
I will refer to these coefficients, then, as b1, b2, ..., b7.