0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

χ二乗検定

Last updated at Posted at 2021-09-12

一番簡単お手軽な方法。関数に入れるndarrayは質的変数ごとや介入ごとの合計値などを持っている必要がないことに注意。

cross = np.array([[60,30,10], [20,40,40]])
cross

chitest = ss.chi2_contingency(cross)
print('カイ二乗値', chitest[0])
print('p値', chitest[1]) # 片側p値
print('自由度', chitest[2])
print('期待度数表', chitest[3])

カイ二乗値 39.42857142857143
p値 2.7428022661917792e-09
自由度 2
期待度数表 [[40. 35. 25.]
 [40. 35. 25.]]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?