-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoissonDistribution
46 lines (35 loc) · 1.09 KB
/
poissonDistribution
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 22 12:10:51 2019
@author: admin
"""
# In[]:
import numpy as np
import scipy.stats as sp
import matplotlib.pyplot as plt
mu=5
ps=sp.poisson(mu)
x=np.linspace(0,1000,1001)
y=[ sp.poisson(k,mu) for k in x]
fig, ax = plt.subplots(1, 1)
mu=.1
x = np.arange(0, sp.poisson.ppf(0.9999, mu),1)
ax.plot(x, sp.poisson.pmf(x, mu), 'ko-', ms=8, label='poisson pmf')
mu=1
x = np.arange(0, sp.poisson.ppf(0.9999, mu),1)
ax.plot(x, sp.poisson.pmf(x, mu), 'bo-', ms=8, label='poisson pmf')
mu=5
x = np.arange(0, sp.poisson.ppf(0.9999, mu),1)
ax.plot(x, sp.poisson.pmf(x, mu), 'ro-', ms=8, label='poisson pmf')
mu=20
x = np.arange(0, sp.poisson.ppf(0.9999, mu))
ax.plot(x, sp.poisson.pmf(x, mu), 'go-', ms=8, label='poisson pmf')
plt.xlabel('inoculum size')
plt.ylabel('probability of the the inoculum size')
plt.xticks(np.arange(0,40,2))
plt.yticks(np.arange(0,1,.1))
plt.box
plt.grid(which='major', axis='both')
plt.legend(['0.1','1', '5', '20'])
plt.savefig('/Users/admin/Documents/Experiences/Milli/'+'poisson'+ '.pdf',bbox_inches='tight', format='pdf')