chi2gof reports different observed values than reported

2 ビュー (過去 30 日間)
Sheer Wolff
Sheer Wolff 2021 年 7 月 5 日
コメント済み: Sheer Wolff 2021 年 7 月 6 日
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?

回答 (1 件)

Jeff Miller
Jeff Miller 2021 年 7 月 5 日
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.
  1 件のコメント
Sheer Wolff
Sheer Wolff 2021 年 7 月 6 日
ohh I see now. it wasn't clear from the function documentation page. Thank you!

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by