Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Ari Samaranayaka <ari.samaranayaka@ipru.otago.ac.nz> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: simulating random numbers from zero inflated negative binomial estimates |

Date |
Fri, 3 Jun 2011 17:03:58 +1200 |

Dear Paul

For example, if I use the command predict expec, ir

Thank you again Ari On 3/06/2011 2:56 a.m., E. Paul Wileyto wrote:

I'm not sure whether anyone has answered this yet.First, read the help on zinb post-estimation commands. There are manyflavors of "predict" listed there. You will need three of them beforeyou start generating random numbers. The first one you will need is:predict p1, prThat will generate a new variable, p1, which will be the predictedprobability of an inflated zero. All the work is done for you.The second predicted quantity you will need is: predict lp, xbThat will generate the linear combination of predictor variablesweighted by coefficients for the negative binomial part of the model.Finally, you will need:predict alpha, xb eq(#3)which will generate a variable containing the overdispersion parameterfor the negative binomial. With those three bits, you can get on tosimulating.Here's my script: zinb cignums drug week, inf(drug week) predict p1 , pr predict p2 , xb predict lnalpha , xb eq(#3) gen alph=exp(lnalpha) gen xg=rgamma(1/alph, alph*p2) gen pg=rpoisson(xg) gen zi=runiform()>p1 gen newcigs=zi*pg zinb newcigs drug week, inf(drug week) Paul On 6/1/2011 7:13 PM, Ari Samaranayaka wrote:Deaf statalist membersCan some one help me with this question with regards to zero-inflatednegative binomial regression (ZINB command) . I need to see how goodthe fitted model by comparing model outputs with observations. Forthis, I aim to simulate random numbers from fitted model to comparewith observed numbers.Can some one tell me how to simulate random numbers from the fittedmodel please? Is there any post estimation command for this? if not,is it possible to use estimated regression coefficients?Thank you Ari-Sam * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: simulating random numbers from zero inflated negative binomial estimates***From:*"E. Paul Wileyto" <epw@mail.med.upenn.edu>

**References**:**st: simulating random numbers from zero inflated negative binomial estimates***From:*Ari Samaranayaka <ari.samaranayaka@ipru.otago.ac.nz>

**Re: st: simulating random numbers from zero inflated negative binomial estimates***From:*"E. Paul Wileyto" <epw@mail.med.upenn.edu>

- Prev by Date:
**Re: st: reshape WDI from wide to long format** - Next by Date:
**Re: st: Constrained Regression in Stata** - Previous by thread:
**Re: st: simulating random numbers from zero inflated negative binomial estimates** - Next by thread:
**Re: st: simulating random numbers from zero inflated negative binomial estimates** - Index(es):