[R] generate random sample from ZINB

Spencer Graves spencer.graves at pdf.com
Tue Feb 10 23:15:03 CET 2004


      Have you done a search on "www.r-project.org" -> search -> "R site 
search"?  I just got 2 hits there, both of which suggest "Jim Lindsey's 
fmr function in the gnlm package. The help page has an example of both 
ZIP and ZINB model fits. The gnlm package can be downloaded from 
http://alpha.luc.ac.be/~jlindsey/rcode.html ". 

      hope this helps. 
      spencer graves

Haiyan Chen wrote:

>I want to generate 1,000 random samples of sample size=1,000 from ZINB.
>I know there is a rnegbin() to generate random samples from NB, and I know
>I can use
>the following process:
>
>do i=1 to 1000
>
>n=0
>
>do i=1 to 1000
>
> if runi(1)>0.1 then x(i) = 0; else
>x(i)=rnegbin();
>
>n=n+1;
>
>if n>1000 then stop;
>
>end;
>
>output;
>end;
>
>Anybody can help me out with the R code?
>Thanks very much ahead of time.
>Heyen
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list