Test for Poisson distribution

23 visualizzazioni (ultimi 30 giorni)
SBinary
SBinary il 9 Apr 2021
I have a vector of observations (length: 1195).
Previous studies have found the data to have a Poisson distribution, and when I plot the data it closely resembles what I would expect to see from a Poisson distribution (see image below).
And the fit (and quality metrics) looks like the following,
Distribution: Poisson
Log likelihood: -5094.64
Domain: 0 <= y < Inf
Mean: 5.63264
Variance: 5.63264
Parameter Estimate Std. Err.
lambda 5.63264 0.068655
Estimated covariance of parameter estimates:
lambda
lambda 0.0047135
However, when I test the hypothesis using a Cho-squared goodness of fit test (chi2gof) as detailed here, Chi-square goodness-of-fit test - MATLAB chi2gof - MathWorks Nordic, the results indicate that the hypothesis should be rejected (at alpha 0.05).
I am not confident I have not made a mistake, and would really appreciate some input. The following is the code for the chi2gof test,
n = sum(x);
bins = 0:1194;
pd = fitdist(bins','Poisson','Frequency',x');
expCounts = n * pdf(pd,bins);
[h,p,st] = chi2gof(bins,'Ctrs',bins,...
'Frequency',x, ...
'Expected',expCounts,...
'NParams',1)
Here is a sample of x (1:100),
x = [3,1,3,4,0,0,0,4,10,2,0,4,6,2,2,2,5,2,0,4,4,2,1,2,3,3,6,0,3,2,0,0,2,4,4,3,0,0,2,3,0,0,0,0,0,0,0,0,1,1,3,2,2,2,1,8,2,4,6,0,3,1,3,1,3,1,1,4,1,2,9,6,6,0,11,3,0,1,2,2,3,0,6,0,3,0,8,5,8,6,7,5,5,0,8,1,3,0,0,8]

Risposte (1)

Abdolkarim Mohammadi
Abdolkarim Mohammadi il 9 Apr 2021
Modificato: Abdolkarim Mohammadi il 9 Apr 2021
Maybe the problem is that you have created too many bins; one bin for each observation. That would not yield good results. Consider lowering the number of bins.
In addition, x is your data and NOT the frequency. You can use the histcounts() function to get the desired bins.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by