This question already has an answer here:
I'd like to create a reference sheet of common distributions for my statistical theory class, but I'm having some issues understanding R's implementation of the negative binomial distribution in the
stats package. Here's the code I've been using to visualize the distribution.
ggplot(data.frame(x=c(0:30)), aes(x)) + stat_function(geom="point", n=16, fun=dnbinom, # Arguments to pass to dnbinom() args = c(p = 0.2, size = 2))
By my understanding of the NBD, p = 0.2 should be the probability of success (or failure, depending on your framing), and size = 2 should be the number of successes we are looking to observe. However, the output of the plot is this image.
I'm having trouble understanding how it's possible to have any probability mass at 0, before we've run any trials at all. I've read the documentation for dnbinom(), but I'm still not sure why this is the result, and the docs don't offer details on the exact equation that was implemented, or a sufficiently basic example that would show how the function works. Any advice/input would be much appreciated. Thanks!