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 1 year has passed since last update.

Octave でマン・ホイットニーの U 検定

Last updated at Posted at 2022-07-11

Octave で独立 2 標本の代表値の差の検定(マン・ホイットニーの U 検定)

独立 2 標本の代表値の差の検定は,ノンパラメトリック検定である「マン・ホイットニーの U 検定」で行う。

usage:
[pval, z] = u_test (x, y, alt)

x, y はデータベクトル
alt はデフォルトで両側検定 "!=", 片側検定は,帰無仮説が「y > x の確率が 0.5 より大きい」なら ">", その逆なら "<" で指定
戻り値を指定しない場合は p 値のみを表示する
pkg load statistics   % statistics が必要
format long           % 表示精度を高くする(任意)
x = [49.6; 52.5; 48.3; 50.6; 56.7; 32.8; 51.6; 46.1; 54.6; 52.0; 39.3; 49.5; 45.1; 37.1; 63.9;
     48.3; 37.4; 33.4; 37.8; 51.2; 63.0; 74.3; 54.4; 60.1; 55.6; 49.3; 57.4; 40.4; 57.8; 60.9];
y = [48.7; 36.8; 51.9; 65.5; 62.6; 57.3; 43.3; 57.7; 61.4; 69.8; 48.0; 37.1; 29.8; 53.6; 49.3;
     50.2; 46.1; 50.6; 51.4; 61.0; 50.8; 51.7; 52.4; 57.3; 55.4];
median(x), median(y)
ans = 50.90000000000001
ans = 51.70000000000000
u_test(x, y);
  pval: 0.531699
[pval, z] = u_test(x, y);
printf("z = %.5g,  p value = %.5g\n", z, pval)
z = -0.62541,  p value = 0.5317
[pval, z] = u_test(x, y, "<");
printf("z = %.5g,  p value = %.5g\n", z, pval)
z = -0.62541,  p value = 0.73415
[pval, z] = u_test(x, y, ">");
printf("z = %.5g,  p value = %.5g\n", z, pval)
z = -0.62541,  p value = 0.26585
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?