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$.

• I'm confused: $N$ is a random variable, not a population parameter you might want to estimate. Do you want to find its expected value (the average)? Commented Jan 18, 2014 at 14:50
• Apologies. I understand why it's confusing. The average time between Poisson events is an exponential. So forget the poisson distribution, where n is the random variable. The probabilistic model we are using is actually an exponential where n (the size of the sample of exponential random variables) is actually a parameter. Commented Jan 18, 2014 at 15:40
• Note the time between Poisson events, not the average time, follows an exponential distribution with mean equal to the reciprocal of the rate parameter, i.e. $1/\lambda$. Commented Jan 21, 2014 at 21:29
• Given $\lambda$ and $T$, the number of arrivals in $(0,T]$ is a Poisson random variable $N$ with parameter $\lambda T$. Let us ask, if we were to bet on the value of $N$, which value should we bet on? Answer: that $n$ for which $P\{N=n\}=e^{-\lambda T}\frac{(\lambda T)^n}{n!}$ is the largest. As in my comment on Scortchi's answer, $$\frac{P\{X=n+1\}}{P\{X=n\}} = \frac{\lambda T}{n+1}$$ etc. Commented Jan 21, 2014 at 22:07

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, 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.

‡ 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)$$

• More simply, the likelihood function for $n$ is $f_n(t)=\frac{\lambda^n}{(n-1)!} \cdot t^{n-1} \cdot \mathrm{e}^{-\lambda t}$ and so $$\frac{f_{n+1}(t)}{f_n(t)}=\frac{\lambda t}{n} > 1 ~ \text{as long as}~ \lambda t > n.$$ So the maximum value of $f_n(t)$ occurs at $n_0 = \lceil \lambda t \rceil$. Note that if $\lambda t$ is an integer, then both $n_0$ and $n_0+1$ are maximum-likelihood estimates of $n$ and this formulation chooses the more pessimistic value (or more optimistic value depending on one's viewpoint, e.g. $n$ is the number of failures!). Commented Jan 21, 2014 at 14:57
• @Dilip Cleverer - should be an answer Commented Jan 21, 2014 at 15:31