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
[email protected]
*
* 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/