LoginSignup
0
0

More than 1 year has passed since last update.

scipy.stats: 独立 k 標本の等分散性の検定

Posted at

scipy.stats: 独立 k 標本の等分散性の検定

複数の群の母分散が等しいかどうか検定する。

帰無仮説 $H_0$: それぞれの母分散は等しい。$\sigma^2_1 = \sigma^2_2 = \dots = \sigma^2_k$

対立仮説 $H_1$: それぞれの母分散は等しいとはいえない。$\sigma^2_1 = \sigma^2_2 = \dots = \sigma^2_k$ ではない(どこか少なくとも 1 つの等号は不等号である)。

1. Levene 検定,Brown-Forsythe 検定

levene(*args, center='median', proportiontocut=0.05)

関数名が levene であるが,それはデフォルトの center='median' から見れば不適切である。

Levene は center='mean' に相当する検定を提唱した(1960)。

Brown と Forsythe は後に center='median' とする検定を提唱した(1974)。そのため,Brown-Forsythe 検定と呼ばれることもある。

分布が対称な場合には Levene 検定,そうでない場合には Brown-Forsythe 検定が推奨されるが,現在では特にこのような区別をしないで Brown-Forsythe 検定が使われることが多い。そのため,デフォルトで center='median' となっているのであろう。

これらのことは Help に書いてあるが,読まずに検定関数を使っている人も多いかもしれない。

from scipy.stats import levene
a = [301, 311, 325, 291, 388, 412, 325, 361, 287];
b = [197, 180, 247, 260, 247, 199, 179, 134, 163, 200];
c = [209, 302, 187, 166, 234, 290, 175, 116];
d = [342, 216, 316, 386, 324, 145, 254, 228]

1.1. Brown-Forsythe 検定

levene(a, b, c, d)
LeveneResult(statistic=2.242478379513558, pvalue=0.10300664426579469)

1.2. Levene 検定

levene(a, b, c, d, center='mean')
LeveneResult(statistic=2.4024185774979356, pvalue=0.08650303516190276)

2. Fligner-Killeen 検定

ノンパラメトリック検定である。leven() と同じく center 引数がある。デフォルトは 'median' であるが,'mean' を選択することもできる。

fligner(*args, center='median', proportiontocut=0.05)

from scipy.stats import fligner

fligner(a, b, c, d)
FlignerResult(statistic=5.380295369379748, pvalue=0.1459761847478772)
fligner(a, b, c, d, center='mean')
FlignerResult(statistic=6.549000694989363, pvalue=0.0877499400483345)

3. Bartlett 検定

有意に正規分布とはいえない母集団からのデータに対しては,前項の Levene 検定, Brown-Forsythe 検定がより頑健である。

bartlett(*args)

from scipy.stats import bartlett

bartlett(a, b, c, d)
BartlettResult(statistic=4.465020251776652, pvalue=0.2154317034832133)
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