Skip to content
Back to formatted view

Raw Message

Message-ID: <OF78DADD36.533FEB8F-ON85256E36.0076C470@health.state.ny.us>
Date: 2004-02-10T21:44:02Z
From: Haiyan Chen
Subject: generate random sample from ZINB

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