# Negative binomial maximum likelihood

The pdf of a negative binomial is

$$θ(X=x)= \left( \begin{array}{c} x+j-1 \\ x \end{array} \right)(1-θ)^xθ^j,$$

How would I create the likelihood of this function in order to maximize θ?And how does the likelihood change if there is n observations vs. 1 observation?

So far, I have that the likelihood is

∏ (j + x − 1 C x)θ^j(1-θ)^x

which is simplified to (through the derivative of the log-likelihood)

=jnlnθ+∑Xln(1-θ)

Meaning that jn/θ=∑X/1-θ

I solved for theta and have:

θ-hat= jn/(jn+∑x)

Is there something wrong? If so, where?

Something extra:

(The alternative pdf is $$P(X=x|j,θ)= \binom{x-1}{j-1}θ^{j}(1-θ)^{x-j}$$

would it yield the same likelihood?)

• $\theta$ should be $p$ on RHS? Aug 16, 2015 at 5:02
• yes, I modified it to be consistent. Aug 16, 2015 at 5:03
• en.wikipedia.org/wiki/…
– user140541
Aug 16, 2015 at 5:27
• I'm not quite sure why the gamma function is used Aug 16, 2015 at 5:33
• I solved for θ and can't see why my answer doesn't match the wiki's? How come they have a summation on the top? Aug 16, 2015 at 6:12

You are using the PDF

$$P(X = x|j, \theta) = {x + j - 1 \choose x}\theta^j(1-\theta)^{x},$$ for $x = 0, 1, \dots$, where $x$ is the number of failures observed before seeing the $j$th success and $\theta$ is the probability of success on any one trial. I am being fussy about writing everything out in full, because (as you will see) every detail is important here.

With data $X_1, X_2, \dots, X_n,$ you set the partial derivative of the loglikelihood function equal to $0$ to find the estimator

$$\hat \theta = \frac{jn}{jn + T},$$ where $T = \sum_{i=1}^n x_i,$ which is the total number of failures seen while waiting for $nj$ successes.

If I read the notes on your derivation correctly, I think you did it correctly.

Furthermore, this estimator of $\theta$ makes sense, because the numerator is the number of successes observed and the denominator is the total number of trials performed.

Now to try to clear up some of your additional questions in the original post and arising from Comments.

(1) What changes if $n = 1$? There is no product sign in the likelihood and so summation sign in the equation to solve for the estimator. The estimator becomes $\hat \theta = j/(j + x).$ Again the estimator is the ratio of the number $j$ of successes to the total number of trials until those $j$ successes are observed.

2) If you change to the alternative PDF, the estimator will still be the number $nj$ of success divided by the total number of trials necessary to to observe them. However, the equation will not look the same, because this is the PDF of a different random variable. Now $X$ is defined as the total number of $trials$ (not $failures$) until $nj$ successes are seen. This random variable takes values $x = j,\, j+1,\, j+2,\, \dots.$

3) Your answer is not the same as the one in Wikipedia because the random variable there counts the number of $successes$ until (in your notation) $nj$ failures are observed. (I frequently refer questioners to Wikipedia, but not always. Sometimes is is not at the right level, has confusing notation, or formulates an issue in a different way than in the problem posted. Sometimes Wikipedia is helpful, sometimes not; here I think not.)