different in Poisson distribution test

22 Ansichten (letzte 30 Tage)
Dan
Dan am 3 Feb. 2026 um 7:40
Verschoben: Torsten am 4 Feb. 2026 um 19:10
I have a problem when i take a test of poisson distribution. I have the data: 0, 1, 2, 0, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 1, 1, 0, 1, 2, 3, 1, 0, 1, 1, 2, 1, 2, 1, 0, 1, 2, 1, 3, 2, 0, 1, 1, 2, 1, 1. I test is wonder the data have Poisson distribution. I use 3 ways:
  1. >> dl=[0, 1, 2, 0, 3, 2, 1, 2, 1, 0, 1, 2, 3, 2, 1, 1, 0, 1, 2, 3, 1, 0, 1, 1, 2, 1, 2, 1, 0, 1, 2, 1, 3, 2, 0, 1, 1, 2, 1, 1];
>> x=unique(dl);
>> ts=histcounts(dl);
>> [h,p]=chi2gof(dl,'CDF',makedist('Poisson',mean(dl)))
the results are: h = 0 p = 0.9810
2. >> n=length(dl);
>> tslt=n*pdf(makedist('Poisson',mean(dl)),x);
>> [h,p]=chi2gof(x,'Ctrs', x, 'Frequency', ts, 'Expected',tslt, 'NParams', 1)
the results are: h = 0 p = 0.1019
3. >> [h,p]=kstest(dl','CDF', makedist('Poisson',mean(dl)))
h =1 p = 7.8989e-08
3 ways return 3 different results. Please help me explain why it is

Akzeptierte Antwort

Torsten
Torsten am 3 Feb. 2026 um 9:39
Bearbeitet: Torsten am 3 Feb. 2026 um 9:55
"kstest" is not applicable since the Poisson Distribution is a discrete, not a continuous distribution.
Since the example "Test for Poisson Distribution" under
shows you how to proceed, I'd go this way.
bins = 0:3;
obsCounts = [7 18 11 4];
n = sum(obsCounts);
pd = fitdist(bins','Poisson','Frequency',obsCounts');
expCounts = n * pdf(pd,bins);
[h,p,st] = chi2gof(bins,'Ctrs',bins,...
'Frequency',obsCounts, ...
'Expected',expCounts,...
'NParams',1,...
'Alpha',0.05)
h = 0
p = 0.1019
st = struct with fields:
chi2stat: 2.6749 df: 1 edges: [-0.5000 0.5000 1.5000 3.5000] O: [7 18 15] E: [10.9013 14.1717 13.2033]
  1 Kommentar
Dan
Dan am 3 Feb. 2026 um 23:59
Verschoben: Torsten am 4 Feb. 2026 um 19:10
thank for your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by