LoginSignup
0

More than 1 year has passed since last update.

scipy.stats: フリードマン検定 friedmanchisquare

Last updated at Posted at 2022-06-06

scipy.stats: フリードマン検定 friedmanchisquare

friedmanchisquare(*args)

関連のある $k$ 標本の代表値の差のノンパラメトリック検定である。
引数の指定法は若干不自由である。
多くの統計パッケージでは以下のようなデータ行列を与える仕様になっていることが多いが,friedmanchisquare では,列ベクトルを複数与える)。

もともと,$k$ 個の配列(ベクトル)で用意されているなら別であるが。

from scipy.stats import friedmanchisquare
import numpy as np
data = np.array([
       [5.4 , 5.5 , 5.55],
       [5.85, 5.7 , 5.75],
       [5.2 , 5.6 , 5.5 ],
       [5.55, 5.5 , 5.4 ],
       [5.9 , 5.85, 5.7 ],
       [5.45, 5.55, 5.6 ],
       [5.4 , 5.4 , 5.35],
       [5.45, 5.5 , 5.35],
       [5.25, 5.15, 5.  ],
       [5.85, 5.8 , 5.7 ],
       [5.25, 5.2 , 5.1 ],
       [5.65, 5.55, 5.45],
       [5.6 , 5.35, 5.45],
       [5.05, 5.  , 4.95],
       [5.5 , 5.5 , 5.4 ],
       [5.45, 5.55, 5.5 ],
       [5.55, 5.55, 5.35],
       [5.45, 5.5 , 5.55],
       [5.5 , 5.45, 5.25],
       [5.65, 5.6 , 5.4 ],
       [5.7 , 5.65, 5.55],
       [6.3 , 6.3 , 6.25]])

戻り値は $\chi^2$ 値と $p$ 値である。

friedmanchisquare(data[:,0], data[:,1], data[:, 2])
FriedmanchisquareResult(statistic=11.142857142857132, pvalue=0.003805040775511383)

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