# Confusion regarding ML estimate

I was going through this article and they have this log likelihood given by $$LL = \sum_{i=1}^n A_i\log p_i + \sum_{i=1}^n A'_i\log(1-p_i).$$

Basically this is the loglikelihood of a logistic regression where pi is the output from the sigmoid function and Ai is the number of entries at $i$ having y value 1 and $A'_i$ is the number of entries at $i$ having y value $0$.

Now the close form solution of this is given by

$$p_i = \frac{A_i}{A_i+A'_i}$$

I didn't get this. Where the above solution came from?

-
I got the idea from this lecture ocw.mit.edu/courses/mathematics/… – user31820 Jun 25 '12 at 15:59
"the close form solution of this.. " that's actually the solution of the derivative of LL set equal to zero (critical point). – leonbloy Jun 25 '12 at 15:59
Where is the article where you saw this log likelihood? Can you link to it? – Chris Taylor Jun 25 '12 at 16:04

The derivative of the log-likelihood with respect to $p_i$ is given by $$\frac{A_i}{p_i}-\frac{A_i'}{1-p_i}.$$ Putting this equal to zero and solving for $p_i$ yields $$p_i=\frac{A_i}{A_i+A_i'}.$$ Of course you should show that this in fact is a maximum and not a minimum, and this is easily done by looking at the second derivative with respect to $p_i$.