R/rtnegbin.R

rtnegbin <-
function(N,mu,dispersion,l.bound){
sample=rep(NA,N)
mu=rep(mu,length=N)
l.bound=rep(l.bound,length=N)
n=1:N
ind=n
while(length(ind)!=0){ ##rejection sampling
sample[ind]=rnbinom(length(ind),mu=mu[ind],size=dispersion)
ind=which(sample<l.bound)
}
return(sample)
}

Try the ocomposition package in your browser

Any scripts or data that you put into this service are public.

ocomposition documentation built on May 2, 2019, 3:30 p.m.