R/rgammapois.R

Defines functions rgammapois

Documented in rgammapois

rgammapois <-
function(n, p, r){
  choosefrom <- 0:10000
  probs <- exp(lgamma(r+choosefrom)-lgamma(choosefrom+1)-lgamma(r)+choosefrom*log(p)+r*log(1-p))
  mysample <- sample(x=choosefrom, size=n, replace=T, prob=probs)
  return(mysample)
}

Try the CNOGpro package in your browser

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

CNOGpro documentation built on May 2, 2019, 5:57 a.m.