Issue
The Skellam distribution is the probability distribution of the difference of two independent Poisson distributed variables. So Skellam is based on subtraction. I've never used it before.
Considering X
and Y
which are two results of two Poisson formulas, precisely X=21.75%
and Y=7.58%
, how to apply the Skellam distribution?
#Calculate Poisson
mu_X = 2.6
X = ((mu_X ** 3) * 2.7182818284 ** (-mu_X)) / 6 * 100
X = 21.75%
mu_Y = 0.5
Y = ((mu_Y ** 2) * 2.7182818284 ** (-mu_Y)) / 2 * 100
Y = 7.58
I had thought of a simple, but it seems too banal, simple and definitely not correct.
#Incorrect use of Skellam
Z = 21.75% - 7.58%
Z = 14.17%
How to properly use the Skellam distribution and use it with Python? I would like to use it with numpy
or scipy
.
Solution
In your question, you're calculating the probability of two Poisson variables with different mean values mu_X
and mu_Y
to assume two values, respectively 3 and 2. You could recalculate your probabilities with
from scipy.stats import poisson
mu_X = 2.6
mu_Y = 0.5
# Calculate the Poisson PMF for k=3 with mean mu_X
prob_X = poisson.pmf(3, mu_X) # about 21%
# Calculate the Poisson PMF for k=2 with mean mu_Y
prob_Y = poisson.pmf(2, mu_Y) # about 7%
The Skellam distribution answers the following questions instead: "What's the probability for the difference of the two Poisson variables above to be equal to a given value"?
To calculate that in Python you would use
from scipy.stats import skellam
# Create a Skellam distribution with the two mean values
dist = skellam(mu_X, mu_Y)
# Calculate the probability of getting 1, just as example
prob = dist.pmf(1) # trying 1 but one could try whatever integer value of the difference
in both cases, .pmf
gives you what you are looking for, the probability (Poisson in the former case, Skellam in the latter) in correspondence of the given input value.
In the case of the Skellam distribution, you'd put in input the value of the difference that you would like to know the probability of.
Answered By - Davide Fiocco
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.