different in Poisson distribution test
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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:
- >> 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
0 commentaires
Réponse acceptée
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)
1 commentaire
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!