Test for Poisson distribution
조회 수: 15 (최근 30일)
이전 댓글 표시
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).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/578092/image.png)
And the fit (and quality metrics) looks like the following,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/578097/image.png)
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]
댓글 수: 0
답변 (1개)
Abdolkarim Mohammadi
2021년 4월 9일
편집: Abdolkarim Mohammadi
2021년 4월 9일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Hypothesis Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!