num4hypothtst 0.0.2-java → 0.0.3-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/ext/num4hypothtst/HypothTest.java +2 -1
- data/ext/num4hypothtst/LeftSideTest.java +5 -1
- data/ext/num4hypothtst/RightSideTest.java +12 -1
- data/ext/num4hypothtst/TwoSideTest.java +20 -1
- data/lib/num4hypothtst.rb +53 -33
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f3db78a057e9644f315ed9a66f7e8229e7b3d6f1c50a304be1ba18b5d4da0a0
|
4
|
+
data.tar.gz: 34a09f03fbeb46c04e31565558f966de27c9cff12e1fb126033ec364dc056256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d5f9dd8d576cdaefcd9bc91ad52d5d70e3efd96cbe2b26f07c67eaec350b0e738c9bec8cdca32d84c6bcfbb7056a878b8b0a795fede0ce20ca7fd4cfbd4f9a9
|
7
|
+
data.tar.gz: fb835295a001d917844e17416d5c1fcf222bd9c3f719beb274fff2a7fcb9c77cdbd123c2c21cfb32cd135ee50f3586c5e70e89c5874857afbce25bcc0db7bca1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## [0.0.3] - 2023-10-05
|
6
|
+
|
7
|
+
### change
|
8
|
+
- chg name of function to normDistTest from normDistest.
|
9
|
+
|
10
|
+
### add
|
11
|
+
- add function of gnTest.
|
12
|
+
|
13
|
+
## [0.0.2] - 2023-10-02
|
14
|
+
|
15
|
+
### change
|
16
|
+
- chg url of homepage
|
17
|
+
|
5
18
|
## [0.0.1] - 2023-10-02
|
6
19
|
|
7
20
|
### Fixed
|
@@ -2,7 +2,8 @@
|
|
2
2
|
interface HypothTest {
|
3
3
|
boolean tDistTest(double statistic, double df, double a);
|
4
4
|
boolean chi2DistTest(double statistic, double df, double a);
|
5
|
-
boolean
|
5
|
+
boolean normDistTest(double statistic, double a);
|
6
6
|
boolean fDistTest(double statistic, double nf, double df, double a);
|
7
|
+
boolean gnTest(double statistic, int n, double a);
|
7
8
|
}
|
8
9
|
|
@@ -21,7 +21,7 @@ public class LeftSideTest implements HypothTest {
|
|
21
21
|
|
22
22
|
return evaluation(statistic, l_val);
|
23
23
|
}
|
24
|
-
public boolean
|
24
|
+
public boolean normDistTest(double statistic, double a) {
|
25
25
|
NormalDistribution norDist = new NormalDistribution(0, 1);
|
26
26
|
double l_val = norDist.inverseCumulativeProbability(a);
|
27
27
|
|
@@ -33,6 +33,10 @@ public class LeftSideTest implements HypothTest {
|
|
33
33
|
|
34
34
|
return evaluation(statistic, l_val);
|
35
35
|
}
|
36
|
+
public boolean gnTest(double statistic, int n, double a) {
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
|
36
40
|
private boolean evaluation(double statistic, double l_val) {
|
37
41
|
boolean ret = true;
|
38
42
|
|
@@ -20,7 +20,7 @@ public class RightSideTest implements HypothTest {
|
|
20
20
|
|
21
21
|
return evaluation(statistic, r_val);
|
22
22
|
}
|
23
|
-
public boolean
|
23
|
+
public boolean normDistTest(double statistic, double a) {
|
24
24
|
NormalDistribution norDist = new NormalDistribution(0, 1);
|
25
25
|
double r_val = norDist.inverseCumulativeProbability(1.0 - a);
|
26
26
|
|
@@ -32,6 +32,17 @@ public class RightSideTest implements HypothTest {
|
|
32
32
|
|
33
33
|
return evaluation(statistic, r_val);
|
34
34
|
}
|
35
|
+
public boolean gnTest(double statistic, int n, double a) {
|
36
|
+
double r_val = calcGnValue(n, a);
|
37
|
+
return evaluation(statistic, r_val);
|
38
|
+
}
|
39
|
+
private double calcGnValue(int n, double a) {
|
40
|
+
TDistribution tDist = new TDistribution(n);
|
41
|
+
double t = tDist.inverseCumulativeProbability(a / n);
|
42
|
+
double gn = (n - 1) * t / Math.sqrt(n * (n - 2 + t * t));
|
43
|
+
|
44
|
+
return Math.abs(gn);
|
45
|
+
}
|
35
46
|
private boolean evaluation(double statistic, double r_val) {
|
36
47
|
boolean ret = true;
|
37
48
|
|
@@ -23,7 +23,7 @@ public class TwoSideTest implements HypothTest {
|
|
23
23
|
|
24
24
|
return evaluation(statistic, l_val, r_val);
|
25
25
|
}
|
26
|
-
public boolean
|
26
|
+
public boolean normDistTest(double statistic, double a) {
|
27
27
|
NormalDistribution norDist = new NormalDistribution(0, 1);
|
28
28
|
double l_val = norDist.inverseCumulativeProbability(a / 2.0);
|
29
29
|
double r_val = norDist.inverseCumulativeProbability(1.0 - a / 2.0);
|
@@ -37,6 +37,17 @@ public class TwoSideTest implements HypothTest {
|
|
37
37
|
|
38
38
|
return evaluation(statistic, l_val, r_val);
|
39
39
|
}
|
40
|
+
public boolean gnTest(double statistic, int n, double a) {
|
41
|
+
double r_val = calcGnValue(n, a / 2.0);
|
42
|
+
return evaluation(statistic, r_val);
|
43
|
+
}
|
44
|
+
private double calcGnValue(int n, double a) {
|
45
|
+
TDistribution tDist = new TDistribution(n);
|
46
|
+
double t = tDist.inverseCumulativeProbability(a / n);
|
47
|
+
double gn = (n - 1) * t / Math.sqrt(n * (n - 2 + t * t));
|
48
|
+
|
49
|
+
return Math.abs(gn);
|
50
|
+
}
|
40
51
|
private boolean evaluation(double statistic, double l_val, double r_val) {
|
41
52
|
boolean ret = true;
|
42
53
|
|
@@ -45,6 +56,14 @@ public class TwoSideTest implements HypothTest {
|
|
45
56
|
}
|
46
57
|
return ret;
|
47
58
|
}
|
59
|
+
private boolean evaluation(double statistic, double r_val) {
|
60
|
+
boolean ret = true;
|
61
|
+
|
62
|
+
if (Math.abs(statistic) < r_val) {
|
63
|
+
ret = false;
|
64
|
+
}
|
65
|
+
return ret;
|
66
|
+
}
|
48
67
|
|
49
68
|
}
|
50
69
|
|
data/lib/num4hypothtst.rb
CHANGED
@@ -17,43 +17,53 @@ module Num4HypothTestLib
|
|
17
17
|
# T検定
|
18
18
|
#
|
19
19
|
# @overload tDistTest(statistic, df, a)
|
20
|
-
# @param [double] statistic
|
20
|
+
# @param [double] statistic 検定統計量
|
21
21
|
# @param [int] df 自由度
|
22
22
|
# @param [double] a 有意水準
|
23
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
23
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
24
24
|
def tDistTest(statistic, df, a)
|
25
25
|
return @hypothTest.tDistTest(statistic, df, a)
|
26
26
|
end
|
27
27
|
# 階2乗検定
|
28
28
|
#
|
29
29
|
# @overload chi2DistTest(statistic, df, a)
|
30
|
-
# @param [double] statistic
|
30
|
+
# @param [double] statistic 検定統計量
|
31
31
|
# @param [int] df 自由度
|
32
32
|
# @param [double] a 有意水準
|
33
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
33
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
34
34
|
def chi2DistTest(statistic, df, a)
|
35
35
|
return @hypothTest.chi2DistTest(statistic, df, a)
|
36
36
|
end
|
37
37
|
# 標準正規分布検定
|
38
38
|
#
|
39
|
-
# @overload
|
40
|
-
# @param [double] statistic
|
39
|
+
# @overload normDistTest(statistic, a)
|
40
|
+
# @param [double] statistic 検定統計量
|
41
41
|
# @param [double] a 有意水準
|
42
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
43
|
-
def
|
44
|
-
return @hypothTest.
|
42
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
43
|
+
def normDistTest(statistic, a)
|
44
|
+
return @hypothTest.normDistTest(statistic, a)
|
45
45
|
end
|
46
46
|
# F検定
|
47
47
|
#
|
48
48
|
# @overload fDistTest(statistic, nf, df, a)
|
49
|
-
# @param [double] statistic
|
49
|
+
# @param [double] statistic 検定統計量
|
50
50
|
# @param [int] nf 自由度
|
51
51
|
# @param [int] df 自由度
|
52
52
|
# @param [double] a 有意水準
|
53
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
53
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
54
54
|
def fDistTest(statistic, nf, df, a)
|
55
55
|
return @hypothTest.fDistTest(statistic, nf, df, a)
|
56
56
|
end
|
57
|
+
# グラブス・スミルノフの外れ値の検定
|
58
|
+
#
|
59
|
+
# @overload gnTest(statistic, n, a)
|
60
|
+
# @param [double] statistic 検定統計量
|
61
|
+
# @param [int] n 自由度
|
62
|
+
# @param [double] a 有意水準
|
63
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
64
|
+
def gnTest(statistic, n, a)
|
65
|
+
return @hypothTest.gnTest(statistic, n, a)
|
66
|
+
end
|
57
67
|
end
|
58
68
|
# 片側(右側)検定
|
59
69
|
class RightSideTestLib
|
@@ -63,43 +73,53 @@ module Num4HypothTestLib
|
|
63
73
|
# T検定
|
64
74
|
#
|
65
75
|
# @overload tDistTest(statistic, df, a)
|
66
|
-
# @param [double] statistic
|
76
|
+
# @param [double] statistic 検定統計量
|
67
77
|
# @param [int] df 自由度
|
68
78
|
# @param [double] a 有意水準
|
69
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
79
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
70
80
|
def tDistTest(statistic, df, a)
|
71
81
|
return @hypothTest.tDistTest(statistic, df, a)
|
72
82
|
end
|
73
83
|
# 階2乗検定
|
74
84
|
#
|
75
85
|
# @overload chi2DistTest(statistic, df, a)
|
76
|
-
# @param [double] statistic
|
86
|
+
# @param [double] statistic 検定統計量
|
77
87
|
# @param [int] df 自由度
|
78
88
|
# @param [double] a 有意水準
|
79
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
89
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
80
90
|
def chi2DistTest(statistic, df, a)
|
81
91
|
return @hypothTest.chi2DistTest(statistic, df, a)
|
82
92
|
end
|
83
93
|
# 標準正規分布検定
|
84
94
|
#
|
85
|
-
# @overload
|
86
|
-
# @param [double] statistic
|
95
|
+
# @overload normDistTest(statistic, a)
|
96
|
+
# @param [double] statistic 検定統計量
|
87
97
|
# @param [double] a 有意水準
|
88
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
89
|
-
def
|
90
|
-
return @hypothTest.
|
98
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
99
|
+
def normDistTest(statistic, a)
|
100
|
+
return @hypothTest.normDistTest(statistic, a)
|
91
101
|
end
|
92
102
|
# F検定
|
93
103
|
#
|
94
104
|
# @overload fDistTest(statistic, nf, df, a)
|
95
|
-
# @param [double] statistic
|
105
|
+
# @param [double] statistic 検定統計量
|
96
106
|
# @param [int] nf 自由度
|
97
107
|
# @param [int] df 自由度
|
98
108
|
# @param [double] a 有意水準
|
99
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
109
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
100
110
|
def fDistTest(statistic, nf, df, a)
|
101
111
|
return @hypothTest.fDistTest(statistic, nf, df, a)
|
102
112
|
end
|
113
|
+
# グラブス・スミルノフの外れ値の検定
|
114
|
+
#
|
115
|
+
# @overload gnTest(statistic, n, a)
|
116
|
+
# @param [double] statistic 検定統計量
|
117
|
+
# @param [int] n 自由度
|
118
|
+
# @param [double] a 有意水準
|
119
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
120
|
+
def gnTest(statistic, n, a)
|
121
|
+
return @hypothTest.gnTest(statistic, n, a)
|
122
|
+
end
|
103
123
|
end
|
104
124
|
# 片側(左側)検定
|
105
125
|
class LeftSideTestLib
|
@@ -109,40 +129,40 @@ module Num4HypothTestLib
|
|
109
129
|
# T検定
|
110
130
|
#
|
111
131
|
# @overload tDistTest(statistic, df, a)
|
112
|
-
# @param [double] statistic
|
132
|
+
# @param [double] statistic 検定統計量
|
113
133
|
# @param [int] df 自由度
|
114
134
|
# @param [double] a 有意水準
|
115
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
135
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
116
136
|
def tDistTest(statistic, df, a)
|
117
137
|
return @hypothTest.tDistTest(statistic, df, a)
|
118
138
|
end
|
119
139
|
# 階2乗検定
|
120
140
|
#
|
121
141
|
# @overload chi2DistTest(statistic, df, a)
|
122
|
-
# @param [double] statistic
|
142
|
+
# @param [double] statistic 検定統計量
|
123
143
|
# @param [int] df 自由度
|
124
144
|
# @param [double] a 有意水準
|
125
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
145
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
126
146
|
def chi2DistTest(statistic, df, a)
|
127
147
|
return @hypothTest.chi2DistTest(statistic, df, a)
|
128
148
|
end
|
129
149
|
# 標準正規分布検定
|
130
150
|
#
|
131
|
-
# @overload
|
132
|
-
# @param [double] statistic
|
151
|
+
# @overload normDistTest(statistic, a)
|
152
|
+
# @param [double] statistic 検定統計量
|
133
153
|
# @param [double] a 有意水準
|
134
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
135
|
-
def
|
136
|
-
return @hypothTest.
|
154
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
155
|
+
def normDistTest(statistic, a)
|
156
|
+
return @hypothTest.normDistTest(statistic, a)
|
137
157
|
end
|
138
158
|
# F検定
|
139
159
|
#
|
140
160
|
# @overload fDistTest(statistic, nf, df, a)
|
141
|
-
# @param [double] statistic
|
161
|
+
# @param [double] statistic 検定統計量
|
142
162
|
# @param [int] nf 自由度
|
143
163
|
# @param [int] df 自由度
|
144
164
|
# @param [double] a 有意水準
|
145
|
-
# return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
165
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
146
166
|
def fDistTest(statistic, nf, df, a)
|
147
167
|
return @hypothTest.fDistTest(statistic, nf, df, a)
|
148
168
|
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: num4hypothtst
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- siranovel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
@@ -19,9 +20,8 @@ dependencies:
|
|
19
20
|
- - ">="
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 12.3.3
|
22
|
-
name: rake
|
23
|
-
prerelease: false
|
24
23
|
type: :development
|
24
|
+
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
@@ -31,6 +31,7 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 12.3.3
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake-compiler
|
34
35
|
requirement: !ruby/object:Gem::Requirement
|
35
36
|
requirements:
|
36
37
|
- - "~>"
|
@@ -39,9 +40,8 @@ dependencies:
|
|
39
40
|
- - ">="
|
40
41
|
- !ruby/object:Gem::Version
|
41
42
|
version: 1.2.5
|
42
|
-
name: rake-compiler
|
43
|
-
prerelease: false
|
44
43
|
type: :development
|
44
|
+
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
@@ -71,7 +71,7 @@ homepage: http://github.com/siranovel/num4hypothtst
|
|
71
71
|
licenses:
|
72
72
|
- MIT
|
73
73
|
metadata: {}
|
74
|
-
post_install_message:
|
74
|
+
post_install_message:
|
75
75
|
rdoc_options: []
|
76
76
|
require_paths:
|
77
77
|
- lib
|
@@ -86,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubygems_version: 3.3.
|
90
|
-
signing_key:
|
89
|
+
rubygems_version: 3.3.7
|
90
|
+
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: num for statistical test
|
93
93
|
test_files: []
|