different in Poisson distribution test

22 visualizaciones (últimos 30 días)
Dan
Dan el 3 de Feb. de 2026 a las 7:40
Movida: Torsten el 4 de Feb. de 2026 a las 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

Respuesta aceptada

Torsten
Torsten el 3 de Feb. de 2026 a las 9:39
Editada: Torsten el 3 de Feb. de 2026 a las 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 comentario
Dan
Dan el 3 de Feb. de 2026 a las 23:59
Movida: Torsten el 4 de Feb. de 2026 a las 19:10
thank for your help!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by