# Trials not starting from 1 - Negative binomial

Trying to tabulate the pmf and cdf of a negative binomial distribution. I have a probability of 0.75, and an success of 2, where the number of trials starts at 2 (x = 2, 3, ...).

I am using r (the language) to calculate and I'm aware that the definitions of the negative binomial are different from my x, but is it a case of starting the vector from 2 to make the distributions match or is there something more complicated? Is the code below going to ensure the distributions passed into the dnbinom and pnbinom functions match up with x?

df <- data.frame(X = 2:20,
pmf = dnbinom(x = 2:20, size, prob),
cdf = pnbinom(q = 2:20, size, prob, lower.tail = TRUE))


The PMF that is outputted from this is:

x   2.000 3.000 4.000 5.000 6.000    7
pmf 0.105 0.035 0.011 0.003 0.001    0

• There are several 'kinds' of negative binomial distribution. Please show the PMF for the one you are using. Commented Nov 15, 2020 at 18:18
• @BruceET - Thanks for the reply. I'm fairly new to stats, the PMF I am using is the one outputted from the code above (added to the question). The only information I have is that X has a negative binomial distribution with r = 2 and p = 3/4. How would I find out the PMF? Commented Nov 15, 2020 at 21:41
• Novice or not, you can look at your text for the explanation of the negative binomial distribution: Are you counting Bernoulli trials up to and including the occurrence of the $r$th Success, or are you counting Failures before the $r$th Success? Or counting something else? Commented Nov 15, 2020 at 21:45
• @BruceET My apologies, I misunderstood. Bernoulli trials up to and including second success. Commented Nov 15, 2020 at 21:54

I solved this by changing the indexing of the vectors passed into the dnbinom and pnbinom functions to start at 0 rather than 2.

df <- data.frame(x = 2:12,
pmf = dnbinom(x = 0:10, size, prob),
cdf = pnbinom(q = 0:10, size, prob, lower.tail = TRUE))


This leads to the expected output:

x   2.000 3.000 4.000 5.000 6.000 7.000 8.000    9
pmf 0.562 0.281 0.105 0.035 0.011 0.003 0.001    0
cdf 0.563 0.844 0.949 0.984 0.995 0.999 1.000    1