maximum-likelihood: a sequence of events described by a Bernoulli distribution

52 Views Asked by At

I am having quite some troubles with the following homework:

In a city it's measured for the whole year whether it rained or not. A distribution $\textrm{Bernoulli}(r_t|\rho)$ characterizes the observations $\{r_t\}_{t=1}^{365}$ where $r_t = 1$ if it rained that day and $r_t = 0$ if it did not rain.

My goal is finding the value of $\rho$ as a maximum likelihood.

One first step is to find the likelihood of the entire set of observations, which I believe is:

$p(r_1,r_2,\ldots,r_t|\rho) = \prod_{t=1}^{365}\rho^{r_t}(1 - \rho)^{1-r_t}$

Considering $n_1$ as the number of rainy days, and $n_0$ the number of not raining days the likelihood is simplified:

$p(r_1,r_2,\ldots,r_t|\rho) =\rho^{n_1}(1 - \rho)^{n_0}$

Hence, the log-likelihood calculated as follows:

$\mathrm{log}p(r_1,r_2,\ldots,r_t|\rho) = n_1\mathrm{log}(\rho) + n_0\mathrm{log}(1-\rho)$

Its derivative seems to be:

$\frac{\mathrm{d}}{\mathrm{d}\rho}\mathrm{log}p(r_1,r_2,\ldots,r_t|\rho) = \frac{n_1}{\rho} + \frac{n_0}{1- \rho}$

Setting the derivative to 0:

$\rho = \frac{n_1}{n_1 - n_0}$

Plugging in the yearly measurements $n_1 = 217$, $n_0 = 148$:

$\rho = \frac{217}{217-148} = 3.145$

Unfortunately this value is not allowed for $\rho$, which should be in the interval $[0,1]$.

What's wrong? I did the calculations several times with the same result.

1

There are 1 best solutions below

0
On BEST ANSWER

You calculated the derivative incorrectly: $\frac{d}{d\rho} \log(1-\rho)=-\frac{1}{1-\rho}$.