I found this question on a past exam and i wanted to know if my solution is correct! I apologize if it's not 100% clear but i'm translating it from italian and it's already written in a really bad form to begin with. Let's suppose that 10 rats are used in a biomedic study. Each of them is injected with poison and after that, they're injected with a serum that is supposed to increase their life duration. The life duration of the 10 rats (in months) is 14, 17, 27, 18,12, 8, 22, 13, 19 e 12. Let's suppose that we use an exponential distribution, calculate the maximum likelihood of the average life duration. This is my solution in matlab:
A = [14, 17, 27, 18,12, 8, 22, 13, 19, 12];
n = 10;
lambda = n/sum(A);
rats = zeros(10);
for i=1:n
rats(i) = lambda*exp(-lambda*A(i));
end
The pdf of an exponential distribution is $$ f_X(x;\lambda) = \lambda e^{-\lambda x} $$ for $x \ge 0$.
Supposing (life duration) data $x_n$ as independent realization, the likelihood writes $$ l(\lambda)= \prod_n f_X(x_n;\lambda) $$
The ML estimator of $\lambda$ minimizes the NLL (negative log likelihood) $$ \phi(\lambda)= \lambda \sum_n x_n - N \log \lambda $$ Computing the derivative yields $$ \phi'(\lambda)= \sum_n x_n - \frac{N}{\lambda} $$ from which $$ \frac{1}{\lambda_{ML}} = \frac{1}{N} \sum_n x_n $$ The RHS is the maximum likelihood of the average life duration.