# Find the parameter of a Poisson, given the distribution function at a known value

Assuming a Poisson distribution, the probability ($\alpha$) that the result will fall within the range $0\ldots k$ is given by the following expression:

$$\alpha = e^{-\lambda}\sum_{i=0}^{k}\frac{\lambda^i}{i!}$$

where $\lambda$ is the expected value (and variance).

In this particular case, the probability ($\alpha$) as well as the range ($k$) is known but the expected value ($\lambda$) is unknown. Is there a analytical solution or close approximation to the value of $\lambda$?

I have so far been solving the problem numerically by minimizing the equation but this is consuming a rather large part of the processing time of my computer which is why I am looking for ways to optimize my code.

• Even something as simple-headed as binary section should take only tiny fractions of a second. Commented Oct 14, 2014 at 9:10
• You are correct. However, the minimization is performed in the order of tens of thousands to hundreds of thousands of times per second. Commented Oct 14, 2014 at 9:20

This is pretty straightforward; we just use the relationship between the Poisson and the chi squared:

If $Y\sim \text{Poisson}(\lambda)$ and $X\sim \chi^2_{2(k+1)}$, for integer $k$, then

$$F_Y(k) = 1-F_{X}(2\lambda) \,.$$

As a result, $$\lambda = \frac{1}{2}\, F_{X}^{-1}(1-F_Y(k))\,.$$

For example, in R, let's try to find the value of $\lambda$ corresponding to $k=6$ and $\alpha=0.1$:

> alpha=.1;k=6
> qchisq(1-alpha,2*(k+1))/2
[1] 10.53207
> ppois(k,10.53207)
[1] 0.1000001


So $\lambda\approx 10.53207$.

On my kids little laptop, running relatively slow R*, $10^5$ such calculations took me a well under a second.

*(compared to C, say)

Hopefully that will be fast enough for you.

• (+1) The inverse chi-square is implemented even in spreadsheet software these days. Commented Oct 14, 2014 at 9:57
• Why are you stealing your kid's little laptop to run R? :p Commented Oct 14, 2014 at 10:02
• Thanks for your help! I made a quick and simple comparison between using the minimization function I used first and your solution. The minimization function was able to calculate $\lambda$ approximately 3000 times per second whereas your solution was able to do it approximately 600 000 times per second. Commented Oct 14, 2014 at 11:50