# How to maximize P(Y = y*) for a negative binomial distribution

## Main Question or Discussion Point

How can I find probability p that maximized P(Y = y*) when Y has a negative binomial distribution with parameters r (known) and p? I've just reduced the problem with some algebra, but other than guess-and-check I have no rigorous way to solve this problem.

Related Set Theory, Logic, Probability, Statistics News on Phys.org
Maximize/minimize = take the derivative and set it equal to zero

Maybe you could elaborate on that? More specifically.

Sorry was just trying to avoid using latex.

But write down your binomial dist. It should be
neg_binomial = A * p^k * (1-p)^r
where A won't depend on p, but will be some combinatoric.

Now take the derivative with respect to p.
A*k*p^(k-1)*(1-p)^r + A*r*p^k*(1-p)^(r-1)
now set that equal to 0 and solve for p. It will be some explicit value depending on your parameters.

Sorry for skimping on the latex, if its too unclear I can re-write it for you.

edit: But the point is that whenever you want to find a max or min, that is an equivalent statement to saying that the slope of the function has to be zero (although a zero slope isn't always a max or min).

I tried it for Y = 11, r = 5. I ended up getting p = -5, which is clearly wrong.

I tried it for Y = 11, r = 5. I ended up getting p = -5, which is clearly wrong.
First off, one obvious mistake on what I wrote to you before.

The second term of the expression should be negative not positive (from the chain rule on the derivative of (1-p)). Maybe double check that the rest is right.

If it still doesn't give a sensible answer I'll work it out explicitly tomorrow.