chi2gof reports different observed values than reported

2 visualizzazioni (ultimi 30 giorni)
Hey,
I'm trying to run a chi-square test for good of fitness.
This is my code:
num_of_intrusions_per_scene = [12 15 35 10 5 31 10 7];
[h,p,stats] = chi2gof(num_of_intrusions_per_scene, 'Expected', ones(1,8)*(mean(num_of_intrusions_per_scene)))
This is the stats output:
chi2stat: 110.0240
df: 7
edges: [5.0000 8.7500 12.5000 16.2500 20.0000 23.7500 27.5000 31.2500 35.0000]
O: [2 3 1 0 0 0 1 1]
E: [15.6250 15.6250 15.6250 15.6250 15.6250 15.6250 15.6250 15.6250]
Notice how O (for observed) is differenct than what is in variable 'num_of_intrusions_per_scene' (the variable I used as observed values).
Any ideas why this might have happened?

Risposte (1)

Jeff Miller
Jeff Miller il 5 Lug 2021
The O values printed by chi2gof are counts of the number of observations in each bin, defined by the bin edges. In this case chi2gof has chosen the first bin as extending from 5.000 to 8.75, and it counted 2 observations in this interval (i.e., the numbers 5 & 7 in your data vector.

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by