I am interested in generating zero-truncated negative binomial random variables using some sort of rejection sampling. My first thought was to simply draw from a negative binomial distribution, and then get rid of any zeroes that may arise. I'd then repeat said process until I reached $N$, the desired number of random values. So something along the lines of
rztnegbin = function(n,k,mu){
size = k
fill = rep(NA,n)
for(i in 1:n){
ztrv = 0
while(ztrv==0){
ztrv = rnbinom(1,size=k,mu=mu)
}
fill[i] = ztrv
}
fill
}
all(rztnegbin(n=100,k=1,mu=5)>0)
Just wanted to make sure that this was appropriate. I'm sure there are more efficient ways out there.