dbnbinom(x, size, alpha = 1, beta = 1, log = FALSE)
pbnbinom(q, size, alpha = 1, beta = 1, lower.tail = TRUE, log.p = FALSE)
rbnbinom(n, size, alpha = 1, beta = 1)
length(n) > 1
,
the length is taken to be the number required.Probability mass function
Warning: cumulative distribution function is defined as
Beta
, NegBinomial
x <- rbnbinom(1e5, 1000, 5, 13)
xx <- 0:1e5
hist(x, 100, freq = FALSE)
lines(xx-0.5, dbnbinom(xx, 1000, 5, 13), col = "red")
hist(pbnbinom(x, 1000, 5, 13))
plot(ecdf(x))
lines(xx, pbnbinom(xx, 1000, 5, 13), col = "red", lwd = 2)
Run the code above in your browser using DataLab