Search code examples
pythonpoissonestimationkernel-density

How to calculate poisson kernel density estimation and p value calculation for given distribution?


In python, given the distribution (expectedValues), gaussian kernel estimation and p value calculation is provided as follows:

kde = scipy.stats.gaussian_kde(expectedValues)
kdePValue = kde.pdf(observedValue)

My question: Is there a way to calculate poisson kernel density estimation for given distribution (expectedValues) and p value calculation for a given observedValue in python?


Solution

  • Actually I computed the probability as follows: I calculated the mean of expected values and give this mean value to the poisson.pmf by importing scipy.stats

                    mu = sum(expectedValues)/len(expectedValues)
                    prob = poisson.pmf(observedValue, mu)