(Note this is not an assignment, but revision for a topic from Cambridge past exam papers) I have been trying to attempt the below question, and I am struggling with part (b).
For (a) it is obvious that the pmf is the same as the Bernoulli and so
$$ f(y;p) = \exp\left(y\log\left(\frac{p}{1-p}\right)+\log(1-p) \right).$$
Then for (b), the log-likelihood is given by $$\ell(\beta,y) = \sum_{i=1}^n \left(y_i\log\left(\frac{p_i}{1-p_i}\right)+\log(1-p_i) \right)$$
Now, $\log(\frac{p}{1-p}) = \beta^Tx \Rightarrow \log(1-p) = \log(p) - \beta^Tx$
And so,
\begin{align} \ell(\beta,y) &= \sum_{i=1}^n y_i\beta^Tx_i + \sum_{i=1}^n \log(p) - \sum_{i=1}^n \beta^Tx_i\\ &= \sum_{i=1}^n y_i\beta^Tx_i + \sum_{i=1}^n \log\left(\frac{e^{\beta^Tx}}{1+e^{\beta^Tx}}\right) - \sum_{i=1}^n \beta^Tx_i \end{align}
And i am unsure how to deal with this middle term, particularly when differentiating, as i cannot get the final answer.
