1
$\begingroup$

I am trying to solve this problem:

Assuming for the phishing values to come from a Poisson distribution of unknown lambda parameter, use the sample values to numerically estimate the parameter with the method of maximum likelihood, compare it with what you would have with the method of moments and with this estimate calculate the probability of having carried out more phishing than the first quartile of those present in test;

What I know is that for continuous random variables it is sufficient to rewrite in R the function of the specific distribution (or its logarithmic version), then through a for loop to multiply all the densities for each x_i belonging to the sample,

and for discrete distributions instead? if I were faced with a Bernoulli distribution (for example), or a Poisson distribution like the one in the exercise above, what should I do?

Note: this is not a duplicate of MSE and MLE with Poisson distribution, I'm my case I'm asking relative to R, more than a single theoretical explanation

$\endgroup$
7
  • $\begingroup$ in practice, in the discrete case do I have to make a production while in the continuous a summation? $\endgroup$
    – fixal92046
    Commented Sep 13, 2022 at 12:54
  • 2
    $\begingroup$ Note that the maximum likelihood estimate for $\lambda$, the expectation of a Poisson distribution, is the sample mean. $\endgroup$
    – statmerkur
    Commented Sep 13, 2022 at 13:09
  • $\begingroup$ I think I understand, so if I were to write in R it would be like this: L_pois = function(lambda) (lambda^sum(k) / factorial(sum(k)))*exp(-lambda) lam = mean(k) qpois(p=1/4, lambda = lam) (referring to the cited exercise) $\endgroup$
    – fixal92046
    Commented Sep 13, 2022 at 13:18
  • $\begingroup$ I didn't do it, I understood that in the case of Poisson $\lambda = mean (sample)$, did I get it wrong? $\endgroup$
    – fixal92046
    Commented Sep 13, 2022 at 13:37
  • $\begingroup$ You're right I didn't think about it, I'll try again $\endgroup$
    – fixal92046
    Commented Sep 13, 2022 at 13:43

0