# Re: st: Predict Command after zinb

 From May Boggess <[email protected]> To [email protected] Subject Re: st: Predict Command after zinb Date 11 Mar 2005 11:21:08 -0600

```On Friday, Anju asked:
>
> 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.
>

Here is an example that shows what -predict- can do after -zinb-:

clear
webuse fish
drop xb
zinb count persons livebait, inf(child camper) nolog
predict xb1,xb
gen myxb1=[count]_b[persons]*persons /*
*/ +[count]_b[livebait]*livebait+[count]_b[_cons]
sum xb1 myxb1

predict xb2,xb equation(#2)
gen myxb2=[inflate]_b[child]*child /*
*/ +[inflate]_b[camper]*camper+ [inflate]_b[_cons]
sum xb2 myxb2

predict p,p
gen myp=exp(xb2)/(1+exp(xb2))
sum p myp

predict n, n
gen myn=(1-p)*exp(xb1)
sum n myn

My technique for finding out what -predict- is up to behinds the scenes
is to use -set trace on-. Now, a lot of times -set trace on- produces
too much output to search through, but I have found that for the
purposes of finding a -predict- formula, there is surprisingly little
output. Then one can look back through the trace to find the generate
statements that -predict- actually used.

By the way, a nice feature of -set trace on- that I have used, is the
highlight. It highlights a specific word in the output making it easier
to find what you are looking for. Type

whelp trace

to see the help file for that.

-- May
[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/
```