1
我寫了一個腳本來擬合泊松分佈,似乎與使用python的random.poisson生成的數據集很好地工作,但它不適用於我需要適合的數據集。 腳本是:Scipy:泊松擬合不適用於特定的數據集
In [6]: from scipy.misc import factorial
In [7]: from scipy.optimize import curve_fit
In [8]: import numpy as np
In [9]: import matplotlib.pyplot as plt
In [11]: def poisson(k, lambd):
....: print(lambd)
....: return(lambd**k/factorial(k))*np.exp(-lambd)
數據是:
In [12]: x = [ 0.0036533, 0.00972361, 0.01579392, 0.02186422, 0.02793453, 0.03400484, 0.04007515, 0.04614546, 0.05221577, 0.05828608, 0.06435639, 0.0704267, 0.07649701, 0.08256731, 0.08863762]
In [13]: y =[ 0.64005518, 0.10825634, 0.05954099, 0.04330254, 0.03383011, 0.02165127, 0.02435768, 0.01623845, 0.01082563, 0.00676602, 0.00947243, 0.00947243, 0.00270641, 0.00405961, 0.00947243]
In [18]: popt, pcov = curve_fit(poisson, x, y)
所以,問題是,這個素文字(= 2.82)發現lambd的最佳價值遠遠高於它應該是。 有人可以幫忙嗎? 在此先感謝
特別是[指數分佈](http://en.wikipedia.org/wiki/Exponential_distribution)通常用作泊松分佈的連續近似 – 2015-03-14 20:27:42