Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Predict Command after zinb


From   "Yulia Marchenko" <ymarchenko@stata.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Predict Command after zinb
Date   Fri, 11 Mar 2005 11:29:36 -0600

Anju wrote:

>I am trying to understand how the predict command
>works after zinb command. I want to know if we can use
>generate command to get the same result as predict
>command.

The formula for the expected number of counts (-predict- with -n- option) is
the following:

 	n=(1-p)*exposure*exp(cons+beta(1)*X(1)+...+beta(p)*X(p))

Here is an example of how you can get the expected number of counts using
the formula:

/****begin do file****/
webuse fish, clear
zinb count persons livebait, inf(child camper) nolog
matrix b=e(b)
/****predict number of counts adjusted for probability of non-zero
count****/
predict double cnt, n
/****predict probability of zero count****/
predict double p, p
/****corresponding formula for the prediction of number of events****/
gen double cntform=(1-p)*exp(b[1,1]*persons+b[1,2]*livebait+b[1,3])
summ count cntform
assert cnt==cntform
/****end do file******/


--Yulia
ymarchenko@stata.com


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index