在scipy中找到卡方检验的自由度?

2024-03-28 09:39:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个麦克斯韦分布观察,我符合预期的麦克斯韦分布。然后我用卡方检验来找出拟合的优度。我得到了很好的结果,但是,我也想找出卡方检验使用的自由度。引用文档chisquare

:p值使用k-1-ddof自由度的卡平方分布计算,其中k是观察到的频率数。ddof的默认值为0。在

k到底是什么?是我拥有的数据点总数(41000)吗?还是每个箱子的频率?enter image description here


Tags: 数据文档频率总数箱子优度ddofchisquare
2条回答

kf_obs的大小,chisquare的第一个参数。这是垃圾箱的数量。在

例如,在下面的docstring示例中

>>> chisquare([16, 18, 16, 14, 12, 12])
(2.0, 0.84914503608460956)

f_obs[16, 18, 16, 14, 12, 12]k是{},或6。在

文档遵循典型的统计变量名称。K-1是自由度。K代表每种尺寸n的样本量,所以用你的话说就是每箱的频率。在

http://statistics.about.com/od/Inferential-Statistics/a/What-Is-A-Degree-Of-Freedom.htm的最后一段内容如下:

Another example of a different way to count the degrees of freedom comes with an F test. In conducting an F test we have k samples each of size n. The degrees of freedom in the numerator is k - 1 and in the denominator is k(n - 1).

相关问题 更多 >