
Cristian M. answered 07/12/22
MS Statistics Graduate with 5+ Years of Tutoring Experience
We have a random sample of variates from a Bernoulli distribution (a simple success-fail, 1-0 experiment for one trial, and with probability of success p). To know how the sample overall behaves, we need its joint density function which will be "re-branded" here as a likelihood function of p given the data we're seeing. (For this, we'll need to take a product from i = 1 to n, hence the Π symbol shown in the work below.) Note that the Bernoulli(p) density function is px(1-p)1-x.
L(p) = f( x | p) = Π pxi(1-p)1-xi = pΣxi (1-p)n-Σxi
Now with the joint density function, let's take the logarithm of it. This gives the log-likelihood function:
l(p) = ln(L(p)) = ln (pΣxi (1-p)n-Σxi )
l(p) = (Σxi )ln(p) + (n-Σxi )ln(1-p)
Now we take the (partial) derivative of l(p) with respect to p and set this derivative equal to zero. From there, solve for p to get the MLE estimate for p.
(δl/δp)l(p) = ((Σxi ) / p ) - ((n-Σxi ) / (1-p)) = 0
((Σxi ) / p ) = ((n-Σxi ) / (1-p))
(Σxi ) (1-p) = (n-Σxi ) (p)
Σxi - pΣxi = pn - pΣxi
Σxi = pn
(Σxi / n) = p
Doesn't that look a lot like the definition of x-bar? This is precisely that!
The MLE estimate for p is x-bar = (Σxi / n).