将泊松分布拟合到数据

Fit poisson distribution to data

我已经绘制了一个直方图,并希望对直方图拟合泊松分布。为此,我将 x 和 y 直方图坐标向量传递给 poissfit() 函数来估计 lambda。

例如,这是我所做的:

expecteddata = cat(2,x,y)
[l,lci] = poissfit(expecteddata)

我的输出是这样的:

l =

   44.3766    0.0130


lci =

   42.8887    0.0003
   45.8645    0.0724

我假设我对绘图感兴趣的 lambda 是 0.013(我认为我的 lambda 太小了,因为我的直方图是频率直方图)。我使用以下方法绘制泊松 pdf:

x = 0:50
y = poisspdf(x,0.013);
plot(x,y,'r')

我得到了叠加图:

但是,我认为这个拟合分布看起来有点奇怪。它看起来不太像 "poisson"。有谁知道我是否做错了什么?

"I have plotted a histogram and would like to fit a poisson distribution to the histogram."

据我了解,您需要将泊松分布拟合到现有的测量数据直方图。我相信你可以使用 fitdist() 功能。

例如,如果您的数据是 x

[n,bin]=hist(x,100);
m=n/trapz(bin,n);
bar(bin,m,'w');
hold on
pd=fitdist(x,'poisson');
y=pdf(pd,bin);
plot(bin,y,'k');
hold off;

会给你一个拟合了泊松分布曲线的直方图。