Maximum likelihood for number of events in Poisson process I have a Poisson process with parameter $\lambda$ known. How do I compute the maximum-likelihood estimator for $N$, ie. the number of events over a specific time spell $T$.
To repeat, I know $\lambda$ and $T$, and I need to find the ML estimator for $N$
I am asking this because, given that the average time between Poisson events can be modelled as an exponential distribution with parameter $\lambda$, I am not even sure which of the two distributions I should use to write down the likelihood function and even if I solve this problem, I would not be able to take derivatives with respect to $N$.
 A: You have an observation $t$ of the total time for occurrence of an unknown but fixed number of events $n$ from a Poisson process with known rate parameter $\lambda$, & want to estimate $n$. Note that the random variable $T$ is the sum of $n$ exponentially distributed random variables (the waiting times between each event†), & therefore has an Erlang distribution (a gamma distribution with an integer shape parameter); the density is
$$f(t) = \frac{\lambda^n}{(n-1)!} \cdot t^{n-1} \cdot \mathrm{e}^{-\lambda t}$$
& the log-likelihood (dropping terms constant in $n$) is
$$\ell(n) =  n \log \lambda t - \log (n-1)!$$
As $n$ is restricted to integer values&ddagger;, trial & error should be efficient enough for finding where the log-likelihood has a maximum; the population mean is ${n}{\lambda}$ so it should be at around $\lambda t$. [As @Dilip has pointed out, you don't in fact need to resort to trial & error: the ratio of likelihoods as $n$ increases is given by
$$ \frac{f_{n+1}}{f_n}=\frac{\lambda t}{n}$$
, which is greater than one while $\lambda t>n$; & so $\hat n = \lceil \lambda t \rceil$.]
† Because the Poisson process is memoryless, it isn't necessary to ask whether the beginning of the time period is at or between event times.
&ddagger; If $n$ weren't restricted to integer values then the score is
$$\frac{\mathrm{d}\ell(n)}{\mathrm{d} n}= \log \lambda t - \frac{\frac{\mathrm{d}\Gamma(n)}{\mathrm{d} n}}{\Gamma(n)}\\
= \log \lambda t - \psi (n)$$
where $\psi(\cdot)$ is the digamma function, & hence the maximum likelihood estimate for $n$ is found where the score is zero:
$$\hat n = \psi^{-1}(\log \lambda t)$$
