Given there are 2 groups that can be modelled as a geometric distribution as follows:

\begin{align*} f(x_i;p_1) &= p_1(1-p_1)^{x_i - 1} \; x_i = 1,2,... \; 0<p_1 <1 \\ f(y_i;p_2) &= p_1(1-p_2)^{y_i - 1} \; y_i = 1,2,... \; 0<p_2 <1 \end{align*}

Suppose that $p1 = p2 = p$. Plot the likelihood for the function for $p$ given that for group 1, $n_1 = 60$, and for group 2, $n_2 = 40$ and the $\sum x_i = 205$ and $\sum y_i = 215$.

My attempt

From what I understand, given that the random variables $X,Y \overset{iid}{\sim} \mathrm{Geometric}(p)$ and that $p_1= p_2$, we can find the joint probability function as follows.

\begin{align} f_{X,Y} &= f_{X}(x)f_{Y}(y) \\ &= p(1-p)^{x_i-1}p(1-p)^{y_i-1} \\ &= p^2(1-p)^{x+y-2} \end{align}

From that, we can take find the likelihood equation for the joint function.

\begin{align} L(x_i,y_i| p) &= \prod_{i = 1}^{n}p^2(1-p)^{x+y-2} \\ &= (p^2)^{n}(1-p)^{\sum_{i = 1}^{n} (x_i + y_i - 2n)} \\ &= p^{2n}(1-p)^{\sum_{i = 1}^{n} (x_i + y_i - 2n)} \end{align}

The log-likelihood function would be as follows.

\begin{align} \ell(x_i, y_i | p) &= \ln{(p^{2n}(1-p)^{\sum_{i = 1}^{n} (x_i + y_i - 2n)})} \\ &= 2n\ln{(p)} + \left(\sum_{i = 1}^{n} (x_i + y_i - 2n)\right)\ln{(1-p)} \end{align}

My question

I am unsure as how to plot the function. Given that there are 2 groups with differing numbers, I think my likelihood equation I have calculated may be wrong. I am unsure if the resultant likelihood and log-likelihood function should contain parameters $n_1$ and $n_2$. Any help would be appreciated to see if I am missing something or I am misunderstanding the question.


1 Answer 1


A valiant attempt, but you have got yourself into trouble because you have not written out your likelihood function correctly. You appear to have tried to first create a likelihood function for one value from each sample and then you have taken a product over $n$ terms. The problem with this is that the sample sizes from the two groups differ, so you should have sample sizes $n_1$ and $n_2$ --- there is no single value for $n$ here.

To derive the correct expression for the likelihood function, you should take the product of the sampling densities over all the data points from both samples, allowing for the fact that the sample sizes from the two samples may differ. Doing this gives the correct expression:

$$\begin{align} L_{\mathbf{x}, \mathbf{y}}(p) &= \prod_{i=1}^{n_1} \text{Geom}(x_i | p) \times \prod_{i=1}^{n_2} \text{Geom}(y_i | p) \\[6pt] &= \prod_{i=1}^{n_1} p(1-p)^{x_i-1} \times \prod_{i=1}^{n_2} p(1-p)^{y_i-1} \\[8pt] &= p^{n_1} (1-p)^{\sum x_i-n_1} p^{n_2} (1-p)^{\sum y_i-n_2} \\[18pt] &= p^{n_1 + n_2} (1-p)^{\sum x_i + \sum y_i - n_1 - n_2}. \\[6pt] \end{align}$$

which gives the corresponding log-likelihood:

$$\ell_{\mathbf{x}, \mathbf{y}}(p) = (n_1+n_2) \log (p) + (\sum x_i + \sum y_i - n_1 - n_2) \log(1-p).$$

Substituting the values $n_1 = 60$, $n_2=40$, $\sum x_i = 205$ and $\sum y_i = 215$ you then get the specific log-likelihood function:

$$\ell_{\mathbf{x}, \mathbf{y}}(p) = 100 \log (p) + 320 \log(1-p).$$

You should be able to plot the log-likelihood function reasonably well over the range $0<p<1$, bearing in mind that it will go to negative infinity at the parameter boundaries, so the function will "fall off the plot" near these boundaries. (You could plot the likelihood function if you prefer, but it will be quite a distinct spike, so the log-likelihood will probably be a better visual representation.)

  • $\begingroup$ Thank you for pointing this out to me. I can now see where I have gotten this wrong. I have assumed that I could join them them earlier in a joint distribution function instead of individually deriving a likelihood function for each probability. $\endgroup$ Mar 23, 2023 at 13:23
  • $\begingroup$ Kind of --- as you can see from my own working, the probabilities for the two samples are already joined in the first step of the working, and the rest is just substitution of the density/mass functions, and then some algebra. $\endgroup$
    – Ben
    Mar 23, 2023 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.