EM for zero-inflated negative binomial regression (source code)

= EM for zero-inflated negative binomial regression
{c}

For known size $r$ and $\lambda_i=e^{x_i^T\beta}$, the <expectation-maximization algorithm> gives structural-zero responsibility $t_i=0$ for positive counts and $t_i=\pi/[\pi+(1-\pi)(r/(r+\lambda_i))^r]$ for zero counts. This is <Bayes theorem>. Maximizing the expected complete-data <log-likelihood> gives $\pi_{\rm new}=n^{-1}\sum_i t_i$ and a weighted <negative binomial regression> with weights $1-t_i$. The objective separates into a Bernoulli mixing term and a weighted count term, which proves the update.