# Derivation of a the log-likelihood for a regression model where the outcome is a mixture between Poisson and a point mass at zero

Suppose $\textbf{Y} = (Y_1, \dots, Y_n)'$ are independent and

\eqalign{ Y_i = 0 & \text{with probability} \ p_i+(1-p_i)e^{-\lambda_i}\\ Y_i = k & \text{with probability} \ (1-p_i)e^{-\lambda_i} \lambda_{i}^{k}/k! }

and

\eqalign{ \log(\mathbf{\lambda}) &= \textbf{B} \beta \\ \text{logit}(\textbf{p}) &= \log(\textbf{p}/(1-\textbf{p})) = \textbf{G} \mathbf{\gamma}. }

How do we derive the log-likelihood of $\textbf{Y}$? I know that it is $$L(\gamma,\mathbf{\beta} | \textbf{Y}) = \sum_{y_i=0} \log(e^{G_i \gamma}+\exp(-e^{\textbf{B}_i \mathbf{\beta}})) +\sum_{y_i >0} (y_i \textbf{B}_i \mathbf{\beta}-e^{\textbf{B}_i \mathbf{\beta}})-\sum_{i=1}^{n} \log(1+e^{G_{i} \gamma})-\sum_{y_i >0} \log(y_{i}!)$$

Added. I think that the likelihood function will be $$\prod_{Y_i=0} p_i+(1-p_i)e^{-\lambda_i} \times \prod_{Y_i >0} (1-p_i)e^{-\lambda_i} \lambda_{i}^{k}/k!$$

Then we know that $\lambda = \exp(\textbf{B} \beta)$ and $p = \frac{1}{1+\exp(-G \gamma)}$. So we just substitute these values and take logs?

• @Macro: It is not homework. I am reading a paper. I changed it to "I think it will be". – Damien Jul 10 '12 at 22:59

Your specification of the likelihood in terms of $p_{i}$ and $\lambda_{i}$:

$$\prod_{i: \ Y_i=0} p_i+(1-p_i) \exp \{-\lambda_i \} \times \prod_{i: \ Y_i >0} (1-p_i)\exp \{-\lambda_i \} \lambda_{i}^{Y_i}/Y_i!$$

is correct, directly from your model formulation. Taking logs and omitting the constant factorial term, the log-likelihood is

$$\sum_{i: \ Y_i=0} \log \left(p_i + (1-p_i)\exp \{-\lambda_i \} \right) + \sum_{i: \ Y_i >0}\Big( \log(1-p_i) - \lambda_i + Y_i \log(\lambda_i) \Big)$$

Now using that $p_i = \frac{1}{1 + \exp\{-{\bf G}_{i} {\boldsymbol \gamma}\}}=\frac{\exp\{{\bf G}_{i} {\boldsymbol \gamma}\}}{1+\exp\{{\bf G}_{i} {\boldsymbol \gamma}\}}$ and $\lambda_i = \exp \{ {\bf B}_{i} {\boldsymbol \beta} \}$ and substituting into the equation above and using the fact that $\log(A/B)=\log(A)-\log(B)$ a number of times, the expression above becomes:

\begin{align*} & \ \ \ \sum_{i: \ Y_i=0} \log \left( \frac{\exp\{{\bf G}_i {\boldsymbol \gamma}\}}{1 +\exp\{{\bf G}_i {\boldsymbol \gamma}\}} + \frac{1}{1 + \exp\{{\bf G}_i {\boldsymbol \gamma}\}} \exp \{ -\exp \{ {\bf B}_i {\boldsymbol \beta} \} \} \right) \\ &+ \sum_{i: \ Y_i >0} \log \left( \frac{1}{1 + \exp\{{\bf G}_i {\boldsymbol \gamma}\}} \right) - \exp \{ {\bf B}_i {\boldsymbol \beta} \} + Y_i {\bf B}_i {\boldsymbol \beta} \\ &= \sum_{i: \ Y_i=0} \log \Big(\exp\{{\bf G}_i {\boldsymbol \gamma}\} + \exp \{ -\exp \{ {\bf B}_i {\boldsymbol \beta} \} \} \Big) - \log(1 + \exp\{{\bf G}_i {\boldsymbol \gamma}\}) \\ &+ \sum_{i: \ Y_i >0} \log(1) - \exp \{ {\bf B}_i {\boldsymbol \beta} \} + Y_i {\bf B}_i {\boldsymbol \beta}- \log(1+\exp\{{\bf G}_i {\boldsymbol \gamma}\})\\ &= \sum_{i: \ Y_i=0} \log \Big(\exp\{{\bf G}_i {\boldsymbol \gamma}\} + \exp \{ -\exp \{ {\bf B}_i {\boldsymbol \beta} \} \} \Big) + \sum_{i: \ Y_i >0} \Big( Y_i {\bf B}_i {\boldsymbol \beta} - \exp \{ {\bf B}_i {\boldsymbol \beta} \} \Big) \\ & \ \ \ \ \ \ \ \ - \sum_{i=1}^{n} \log(1+\exp\{{\bf G}_i {\boldsymbol \gamma}\}) \end{align*}

which is exactly the likelihood equation you were trying to derive (without the constant factorial term which is not necessary).

• How do you take the log of the sum in the first line?? – whuber Jul 11 '12 at 21:03
• @whuber, I'm not sure what you're asking. Yes, there's no convenient formula for $\log(a+b)$ but you can still take the log of $a+b$ :) all I did there was $$\log \left( \prod_{i: \ Y_i=0} p_i+(1-p_i) \exp \{-\lambda_i \} \right) = \sum_{i: \ Y_i=0} \log \left(p_i + (1-p_i)\exp \{-\lambda_i \} \right)$$ – Macro Jul 12 '12 at 12:23
• I believe the sum in the first line should be a product. – whuber Jul 12 '12 at 12:32
• @whuber, Oops. Yes it should be $\times$ not $+$. I was wondering what you were talking about ... This same typo appears in the original question - odd how one can sometimes be completely unable to see things like that since they know what they meant to write :) – Macro Jul 12 '12 at 12:34