Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Fitting Poisson distribution
# Aim :
# Ex.no:2 Fitting Poisson distribution

# Name : Punniyakotti.M
# Register number : 24006503

# Aim :
To fit poisson distribution for the arrival of objects per minute from the feeder

# Software required :
Expand Down Expand Up @@ -29,10 +32,52 @@ The Poisson distribution is the discrete probability distribution of the number
![image](https://user-images.githubusercontent.com/103921593/230282876-f4a5afbf-cac1-4648-a1b0-c78840638a8e.png)

# Program :
```py
Developed by : KIRTHICK SHA R
Register number :24900676

import numpy as np
import math
import scipy.stats
L=[int(i) for i in input().split()]
N=len(L); M=max(L)
X=list();f=list()
for i in range (M+1):
c = 0
for j in range(N):
if L[j]==i:
c=c+1
f.append(c)
X.append(i)
sf=np.sum(f)
p=list()
for i in range(M+1):
p.append(f[i]/sf)
mean=np.inner(X,p)
p=list();E=list();xi=list()
print("X P(X=x) Obs.Fr Exp.Fr xi")
print("--------------------------")
for x in range(M+1):
p.append(math.exp(-mean)*mean**x/math.factorial(x))
E.append(p[x]*sf)
xi.append((f[x]-E[x])**2/E[x])
print("%2.2f %2.3f %4.2f %3.2f %3.2f"%(x,p[x],f[x],E[x],xi[x]))
print("--------------------------")
cal_chi2_sq=np.sum(xi)
print("Calculated value of Chi square is %4.2f"%cal_chi2_sq)
table_chi2=scipy.stats.chi2.ppf(1-.01,df=M)
print("Table value of chi square at 1 level is %4.2f"%table_chi2)
if cal_chi2_sq<table_chi2:
print("The given data can be fitted in poisson Distribution at 1% LOS")
else:
print("The given data cannot be fitted in Poisson Distribution at 1% LOS")

```



# Output :
![image](https://github.com/user-attachments/assets/f9610143-0c90-42e3-9e29-5dea60c7e4d1)



Expand Down