different in Poisson distribution test

21 vues (au cours des 30 derniers jours)
Dan
Dan le 3 Fév 2026 à 7:40
Déplacé(e) : Torsten le 4 Fév 2026 à 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

Réponse acceptée

Torsten
Torsten le 3 Fév 2026 à 9:39
Modifié(e) : Torsten le 3 Fév 2026 à 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 commentaire
Dan
Dan le 3 Fév 2026 à 23:59
Déplacé(e) : Torsten le 4 Fév 2026 à 19:10
thank for your help!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by