# How can I obtain the mean of a Poisson distribution given the first improbable point of the distribution?

I generated a Poisson distribution with mean equal to 3 and 10000 samples by using np.random.poisson(3,10000). The plot is the following:

from this plot I see that given the mean equal to 3, a point like 12 is very unlikely to fall into the distribution. Is there a function that given the number 12 and a probability to fall in the distribution, gives me the mean of such distribution ?

I know that from scipy.stats module there is the ppf function that returns the point such that given a mean of the distribution and the probability to have this point and the points lower than this, that is:

st.poisson.ppf(q = 0.99995,mu = 3)


It returns 12, hence I have a 99.995% probability that a Poisson with mean 3 returns a value that is 12 or less. Is there a function that does the opposite ? That given 0.95 and the number 12, gives me the right mean 3 ?

The cumulative distribution function (CDF) for the Poisson distribution is:

$$$$CDF = exp(-\lambda)*\Sigma_{i=0}^{i=|k|}\frac{\lambda^i}{i!}$$$$

It sounds to me that you have particular values for $$CDF$$ and $$k$$ and you want to solve for $$\lambda$$.

You can do this using scipy.optimize.fsolve https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.fsolve.html?highlight=fsolve

from scipy.optimize import fsolve
from scipy.stats import poisson

def myCallable(lambda_):
return 0.95-poisson.cdf(12, lambda_)

mu = fsolve(myCallable, x0=[2.5])


I got $$\lambda = 7.68957829$$ for $$CDF=0.95$$ and $$k=12$$. I double-checked this using poisson.ppf that you referenced in your question and the value is correct, so I'm not sure where the value of $$3$$ is coming from. Hope this helps

• Thank you. It is one approach very interesting ! Anyway I modified the question trying to make it clearer. Sep 20, 2022 at 15:32