LoginSignup
0

More than 1 year has passed since last update.

scipy.stats: アンサリ・ブラッドレイ検定 ansari

Last updated at Posted at 2022-06-06

scipy.stats: アンサリ・ブラッドレイ検定 ansari

ansari(x, y, alternative='two-sided')

独立二標本の等分散のノンパラメトリック検定である。

戻り値は,検定統計量と $p$ 値である。

同順位がある場合は,Warning が発せられる。

from scipy.stats import ansari
import numpy as np

x = np.array([111, 107, 100, 99, 102, 106, 109, 108, 104, 99,
            101, 96, 97, 102, 107, 113, 116, 113, 110, 98])
y = np.array([107, 108, 106, 98, 105, 103, 110, 105, 104,
            100, 96, 108, 103, 104, 114, 114, 113, 108, 106, 99])
ansari(x, y)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scipy/stats/_morestats.py:2339: UserWarning: Ties preclude use of exact statistic.
  warnings.warn("Ties preclude use of exact statistic.")

AnsariResult(statistic=185.5, pvalue=0.1814581997286706)

同順位がない場合には何の問題も起こらない。

a = np.array([39.144, 59.973, 52.830, 34.937, 44.214,
              66.514, 25.733, 45.711, 62.659, 41.333,
              43.211, 49.053, 64.914, 43.611, 45.560,
              45.656, 72.059, 71.868, 60.041, 53.862])
b = np.array([61.061, 72.361, 35.962, 67.637, 31.192,
              40.434, 63.607, 28.570, 47.899, 37.074,
              46.166,  8.021, 23.427, 39.502, 63.912,
              47.395, 50.043, 60.323, 36.807, 54.254])
ansari(a, b)
AnsariResult(statistic=230.0, pvalue=0.2944561134102789)

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