Qeustion: Expected number of accident at a junction is 5 per month. then What is the probability of more than 7 accidents at the junction next month? You can use python scipy library for this. Even though I can do this on a paper, its little difficult to do by coding with these library. Can you help me
the method is
import scipy.stats as stats
find_prob(a,b):
#input: probability of event interval
#output: determined probability
First of all you are only wanted to find the probability larger than seven right?
If yes, I think this is one of the approach to do so ask follow:
from scipy import stats
occur_past = 5
ask_current = 7
mu = occur_past
x = ask_current
upto7 = scipy.stats.poisson.pmf(x, mu)
above7 = 1 - upto7
The output would be 0.8955551370429461
You can simply convert into function as follow:
def poisson(mu, x):
uptocurrent = scipy.stats.poisson.pmf(x, mu)
abovecurrent = 1 - uptocurrent
return abovecurrent
Hope this can help you.