num4tststatistic2 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/lib/num4tststatistic2.rb +366 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 985be5e18949d9700b7a090374a2b2f85ec1caa6551f9659e11156e8d3a02f21
|
4
|
+
data.tar.gz: 860c8e0145f0c045ef2fab8fe7bc84cbf3365ad026e6ccebcee3f092d9996048
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b39c6635a935546f966682151337005a240d53b8869190022b13a550cbfd5f06b04ba3d4202438a406258ba6d44f169fe9a0c336416cd2bf8e409bd7023f903
|
7
|
+
data.tar.gz: 4cb404897944e4aa2ed7a608b292316ce4f2ce38c0771116890f4e025908fddfb4908885f59c3368ca30201138fd6a846fe8afc2c0130f5285589d8da6d18e04
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 siranovel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,366 @@
|
|
1
|
+
require 'num4tststatistic'
|
2
|
+
require 'hypothTest3'
|
3
|
+
|
4
|
+
# 統計的仮説検定
|
5
|
+
module Num4TstStatistic2Lib
|
6
|
+
class ParametrixTestLib
|
7
|
+
def initialize(hypothTest3)
|
8
|
+
@hypothTest3 = hypothTest3
|
9
|
+
@paraTest = Num4TstStatisticLib::ParametrixTestLib.new
|
10
|
+
end
|
11
|
+
# 正規母集団の母平均の検定
|
12
|
+
#
|
13
|
+
# @overload populationMean(xi, m0, a)
|
14
|
+
# @param [Array] xi データ(double[])
|
15
|
+
# @param [double] m0 母平均
|
16
|
+
# @param [double] a 有意水準
|
17
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
18
|
+
# @example
|
19
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
20
|
+
# xi = [15.5, 15.7, 15.4, 15.4, 15.6, 15.4, 15.6, 15.5, 15.4]
|
21
|
+
# paraTest = Num4TstStatisticLib::ParametrixTestLib.new(hypothTest)
|
22
|
+
# paraTest.populationMean(xi, 15.4, 0.05)
|
23
|
+
# => true
|
24
|
+
def populationMean(xi, m0, a)
|
25
|
+
df = xi.size - 1
|
26
|
+
statistic = @paraTest.populationMean(xi, m0)
|
27
|
+
return @hypothTest3.tDistTest(statistic, df, a)
|
28
|
+
end
|
29
|
+
# 正規母集団の母分散の検定
|
30
|
+
#
|
31
|
+
# @overload populationVar(xi, sig0, a)
|
32
|
+
# @param [Array] xi データ(double[])
|
33
|
+
# @param [double] sig0 母分散
|
34
|
+
# @param [double] a 有意水準
|
35
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
36
|
+
# @example
|
37
|
+
# xi = [35.2, 34.5, 34.9, 35.2, 34.8, 35.1, 34.9, 35.2, 34.9, 34.8]
|
38
|
+
# sd = 0.4
|
39
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
40
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
41
|
+
# paraTest.populationVar(xi, sd*sd, 0.05)
|
42
|
+
# => true
|
43
|
+
def populationVar(xi, sig0, a)
|
44
|
+
df = xi.size - 1
|
45
|
+
statistic = @paraTest.populationVar(xi, sig0)
|
46
|
+
return @hypothTest3.chi2DistTest(statistic, df, a)
|
47
|
+
end
|
48
|
+
# 母比率の検定量
|
49
|
+
#
|
50
|
+
# @overload populationRatio(m, n, p0, a)
|
51
|
+
# @param [int] m m値
|
52
|
+
# @param [int] n N値
|
53
|
+
# @param [double] p0 母比率
|
54
|
+
# @param [double] a 有意水準
|
55
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
56
|
+
# @example
|
57
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
58
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
59
|
+
# paraTest.populationRatio(29, 346, 0.12, 0.05)
|
60
|
+
# => true
|
61
|
+
def populationRatio(m, n, p0, a)
|
62
|
+
statistic = @paraTest.populationRatio(m, n, p0)
|
63
|
+
return @hypothTest3.normDistTest(statistic, a)
|
64
|
+
end
|
65
|
+
# 2つの母平均の差の検定量
|
66
|
+
# (等分散性を仮定)
|
67
|
+
#
|
68
|
+
# @overload diffPopulationMean2EquVar(xi1, xi2, a)
|
69
|
+
# @param [Array] xi1 x1のデータ(double[])
|
70
|
+
# @param [Array] xi2 x2のデータ(double[])
|
71
|
+
# @param [double] a 有意水準
|
72
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
73
|
+
# @example
|
74
|
+
# xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
|
75
|
+
# xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
|
76
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
77
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
78
|
+
# paraTest.diffPopulationMean2EquVar(xi1, xi2, 0.05)
|
79
|
+
# => false
|
80
|
+
def diffPopulationMean2EquVar(xi1, xi2, a)
|
81
|
+
n1 = xi1.size
|
82
|
+
n2 = xi2.size
|
83
|
+
df = n1 + n2 - 2
|
84
|
+
statistic = @paraTest.diffPopulationMean2EquVar(xi1, xi2)
|
85
|
+
return @hypothTest3.tDistTest(statistic, df, a)
|
86
|
+
end
|
87
|
+
# 2つの母平均の差の検定量
|
88
|
+
# (不等分散性を仮定)
|
89
|
+
#
|
90
|
+
# @overload diffPopulationMean2UnEquVar(xi1, xi2, a)
|
91
|
+
# @param [Array] xi1 x1のデータ(double[])
|
92
|
+
# @param [Array] xi2 x2のデータ(double[])
|
93
|
+
# @param [double] a 有意水準
|
94
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
95
|
+
# @example
|
96
|
+
# xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
|
97
|
+
# xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
|
98
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
99
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
100
|
+
# paraTest.diffPopulationMean2UnEquVar(xi1, xi2, 0.05)
|
101
|
+
# => false
|
102
|
+
def diffPopulationMean2UnEquVar(xi1, xi2, a)
|
103
|
+
df = @paraTest.df4welch(xi1, xi2)
|
104
|
+
statistic = @paraTest.diffPopulationMean2UnEquVar(xi1, xi2)
|
105
|
+
return @hypothTest3.tDistTest(statistic, df, a)
|
106
|
+
end
|
107
|
+
# 対応のある2つの母平均の差の検定量
|
108
|
+
#
|
109
|
+
# @overload diffPopulationMean(xi1, xi2, a)
|
110
|
+
# @param [Array] xi1 x1のデータ(double[])
|
111
|
+
# @param [Array] xi2 x2のデータ(double[])
|
112
|
+
# @param [double] a 有意水準
|
113
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
114
|
+
# @example
|
115
|
+
# xi1 = [37.1, 36.2, 36.6, 37.4, 36.8, 36.7, 36.9, 37.4, 36.6, 36.7]
|
116
|
+
# xi2 = [36.8, 36.6, 36.5, 37.0, 36.0, 36.5, 36.6, 37.1, 36.4, 36.7]
|
117
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
118
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
119
|
+
# paraTest.diffPopulationMean(xi1, xi2, 0.05)
|
120
|
+
# => true
|
121
|
+
def diffPopulationMean(xi1, xi2, a)
|
122
|
+
n = xi1.size
|
123
|
+
df = n - 1
|
124
|
+
statistic = @paraTest.diffPopulationMean(xi1, xi2)
|
125
|
+
return @hypothTest3.tDistTest(statistic, df, a)
|
126
|
+
end
|
127
|
+
# 2つの母分散の差の検定量
|
128
|
+
#
|
129
|
+
# @overload diffPopulationVar(xi1, xi2, a)
|
130
|
+
# @param [Array] xi1 x1のデータ(double[])
|
131
|
+
# @param [Array] xi2 x2のデータ(double[])
|
132
|
+
# @param [double] a 有意水準
|
133
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
134
|
+
# @example
|
135
|
+
# xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
|
136
|
+
# xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
|
137
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
138
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
139
|
+
# paraTest.diffPopulationVar(xi1, xi2, 0.05)
|
140
|
+
# => false
|
141
|
+
def diffPopulationVar(xi1, xi2, a)
|
142
|
+
nf = xi1.size - 1
|
143
|
+
df = xi2.size - 1
|
144
|
+
statistic = @paraTest.diffPopulationVar(xi1, xi2)
|
145
|
+
return @hypothTest3.fDistTest(statistic, nf, df, a)
|
146
|
+
end
|
147
|
+
# 2つの母比率の差の検定量
|
148
|
+
#
|
149
|
+
# @overload diffPopulationRatio(m1, n1, m2, n2, a)
|
150
|
+
# @param [int] m1 m1値
|
151
|
+
# @param [int] n1 N1値
|
152
|
+
# @param [int] m2 m2値
|
153
|
+
# @param [int] n2 N2値
|
154
|
+
# @param [double] a 有意水準
|
155
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
156
|
+
# @example
|
157
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
158
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
159
|
+
# paraTest.diffPopulationRatio(469, 1200, 308, 900, 0.05)
|
160
|
+
# => true
|
161
|
+
def diffPopulationRatio(m1, n1, m2, n2, a)
|
162
|
+
statistic = @paraTest.diffPopulationRatio(m1, n1, m2, n2)
|
163
|
+
return @hypothTest3.normDistTest(statistic, a)
|
164
|
+
end
|
165
|
+
# 適合度の検定量
|
166
|
+
#
|
167
|
+
# @overload fidelity(fi, pi, a)
|
168
|
+
# @param [Array] fi 実測度数(double[])
|
169
|
+
# @param [Array] pi 比率(double[])
|
170
|
+
# @param [double] a 有意水準
|
171
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
172
|
+
# @example
|
173
|
+
# fi = [57, 33, 46, 14]
|
174
|
+
# pi = [0.4, 0.2, 0.3, 0.1]
|
175
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
176
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
177
|
+
# paraTest.fidelity(fi, pi, 0.05)
|
178
|
+
# => false
|
179
|
+
def fidelity(fi, pi, a)
|
180
|
+
df = fi.size - 1
|
181
|
+
statistic = @paraTest.fidelity(fi, pi)
|
182
|
+
return @hypothTest3.chi2DistTest(statistic, df, a)
|
183
|
+
end
|
184
|
+
# 独立性の検定量
|
185
|
+
#
|
186
|
+
# @overload independency(fij, a)
|
187
|
+
# @param [Array] fij 実測度数(double[][])
|
188
|
+
# @param [double] a 有意水準
|
189
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
190
|
+
# @example
|
191
|
+
# fij = [
|
192
|
+
# [57, 33, 46, 14],
|
193
|
+
# [89, 24, 75, 12],
|
194
|
+
# ]
|
195
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
196
|
+
# paraTest = Num4TstStatistic2Lib::ParametrixTestLib.new(hypothTest)
|
197
|
+
# paraTest.independency(fij, 0.05)
|
198
|
+
# => true
|
199
|
+
def independency(fij, a)
|
200
|
+
m = fij.size
|
201
|
+
n = fij[0].size
|
202
|
+
df = (m - 1) * (n - 1)
|
203
|
+
statistic = @paraTest.independency(fij)
|
204
|
+
return @hypothTest3.chi2DistTest(statistic, df, a)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
class NonParametrixTestLib
|
208
|
+
def initialize(hypothTest3)
|
209
|
+
@hypothTest3 = hypothTest3
|
210
|
+
@nonParaTest = Num4TstStatisticLib::NonParametrixTestLib.new
|
211
|
+
end
|
212
|
+
# マン・ホイットニーのU検定
|
213
|
+
#
|
214
|
+
# @overload utest(x, y, a)
|
215
|
+
# @param [Array] x xのデータ(double[])
|
216
|
+
# @param [Array] y yのデータ(double[])
|
217
|
+
# @param [double] a 有意水準
|
218
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
219
|
+
# @example
|
220
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
221
|
+
# x = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
|
222
|
+
# y = [180, 180, 235, 270, 240, 285, 164, 152]
|
223
|
+
# nonParaTest = Num4TstStatistic2Lib::NonParametrixTestLib.new(hypothTest)
|
224
|
+
# nonParaTest.utest(x, y, 0.05)
|
225
|
+
# => true
|
226
|
+
def utest(x, y, a)
|
227
|
+
statistic = @nonParaTest.utest(x, y)
|
228
|
+
return @hypothTest3.normDistTest(statistic, a)
|
229
|
+
end
|
230
|
+
# ウィルコクス符号付き順位検定
|
231
|
+
#
|
232
|
+
# @overload wilcoxontest(x, y, a)
|
233
|
+
# @param [Array] x xのデータ(double[])
|
234
|
+
# @param [Array] y yのデータ(double[])
|
235
|
+
# @param [double] a 有意水準
|
236
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
237
|
+
# @example
|
238
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
239
|
+
# x = [37.1, 36.2, 36.6, 37.4, 36.8, 36.7, 36.9, 37.4, 36.6, 36.7]
|
240
|
+
# y = [36.8, 36.6, 36.5, 37.0, 36.0, 36.5, 36.6, 37.1, 36.4, 36.7]
|
241
|
+
# nonParaTest = Num4TstStatistic2Lib::NonParametrixTestLib.new(hypothTest)
|
242
|
+
# nonParaTest.wilcoxon(x, y, 0.05)
|
243
|
+
# => true
|
244
|
+
def wilcoxon(x, y, a)
|
245
|
+
statistic = @nonParaTest.wilcoxon(x, y)
|
246
|
+
return @hypothTest3.normDistTest(statistic, a)
|
247
|
+
end
|
248
|
+
# コルモゴルフ・スミルノフ検定(2標本)
|
249
|
+
#
|
250
|
+
# @overload ks2test(xi1, xi2, a)
|
251
|
+
# @param [Array] xi1 x1のデータ(double[])
|
252
|
+
# @param [Array] xi2 x2のデータ(double[])
|
253
|
+
# @param [double] a 有意水準
|
254
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
255
|
+
# @example
|
256
|
+
# hypothTest = Num4HypothTestLib::TwoSideTestLib.new
|
257
|
+
# xi1 = [165, 130, 182, 178, 194, 206, 160, 122, 212, 165, 247, 195]
|
258
|
+
# xi2 = [180, 180, 235, 270, 240, 285, 164, 152]
|
259
|
+
# nonParaTest = Num4TstStatisticLib::NonParametrixTestLib.new(hypothTest)
|
260
|
+
# nonParaTest.ks2test(xi1, xi2, 0.05)
|
261
|
+
# => false
|
262
|
+
def ks2test(xi1, xi2, a)
|
263
|
+
return @nonParaTest.ks2test(xi1, xi2, a)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
class OutlierLib
|
267
|
+
def initialize
|
268
|
+
@outlier = Num4TstStatisticLib::OutlierLib.new
|
269
|
+
@hypothTest2 = Num4HypothTestLib::GrubbsTestLib.new
|
270
|
+
end
|
271
|
+
# グラプス・スミルノフの外れ値の検定量
|
272
|
+
#
|
273
|
+
# @overload grubbs(xi, xk, a)
|
274
|
+
# @param [Array] xi xiのデータ(double[])
|
275
|
+
# @param [double] xk 外れ値
|
276
|
+
# @return [double] 検定統計量
|
277
|
+
# @example
|
278
|
+
# xi = [3.4, 3.5, 3.3, 2.2, 3.3, 3.4, 3.6, 3.2]
|
279
|
+
# outlier = Num4TstStatisticLib::OutlierLib.new
|
280
|
+
# outlier.grubbs(xi, 2.2, 0.05)
|
281
|
+
# => true
|
282
|
+
def grubbs(xi, xk, a)
|
283
|
+
n = xi.size
|
284
|
+
statistic = @outlier.grubbs(xi, xk)
|
285
|
+
@hypothTest2.twoSideTest(statistic, n, a)
|
286
|
+
end
|
287
|
+
# エラーバー出力
|
288
|
+
#
|
289
|
+
# @overload errbar(dname, xi)
|
290
|
+
# @param [String] dname データ名
|
291
|
+
# @param [Array] xi xiのデータ(double[])
|
292
|
+
# @return [void] errbar.jpegファイルを出力
|
293
|
+
# @example
|
294
|
+
# xi = [3.4, 3.5, 3.3, 2.2, 3.3, 3.4, 3.6, 3.2]
|
295
|
+
# outlier = Num4TstStatisticLib::OutlierLib.new
|
296
|
+
# outlier.grubbs("LDH", xi)
|
297
|
+
# => errbar.jpeg
|
298
|
+
def errbar(dname, xi)
|
299
|
+
@outlier.errbar(dname, xi)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
# 無相関の検定
|
303
|
+
class DecorrTestLib
|
304
|
+
def initialize
|
305
|
+
@paraTest = Num4TstStatisticLib::ParametrixTestLib.new
|
306
|
+
@nonParaTest = Num4TstStatisticLib::NonParametrixTestLib.new
|
307
|
+
@hypothTest = Num4HypothTestLib::DecorrTestLib.new
|
308
|
+
end
|
309
|
+
# ピアソン相関係数
|
310
|
+
# (相関係数の検定)
|
311
|
+
#
|
312
|
+
# @overload pearsoCorrelation(x, y, a)
|
313
|
+
# @param [Array] x xのデータ(double[])
|
314
|
+
# @param [Array] y yのデータ(double[])
|
315
|
+
# @param [double] a 有意水準
|
316
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
317
|
+
# @example
|
318
|
+
# x = [113, 64, 16, 45, 28, 19, 30, 82, 76]
|
319
|
+
# y = [31, 5, 2, 17, 18, 2, 9, 25, 13]
|
320
|
+
# paraTest = Num4TstStatistic2Lib::DecorrTestLib.new
|
321
|
+
# paraTest.pearsoCorrelation(x, y, 0.05)
|
322
|
+
# => true
|
323
|
+
def pearsoCorrelation(x, y, a)
|
324
|
+
df = x.size - 2
|
325
|
+
statistic = @paraTest.pearsoCorrelation(x, y)
|
326
|
+
return @hypothTest.twoSideTest(statistic, df, a)
|
327
|
+
end
|
328
|
+
# スピアマンの順位相関係数
|
329
|
+
#
|
330
|
+
# @overload spearmanscorr(x, y, a)
|
331
|
+
# @param [Array] x xのデータ(double[])
|
332
|
+
# @param [Array] y yのデータ(double[])
|
333
|
+
# @param [double] a 有意水準
|
334
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
335
|
+
# @example
|
336
|
+
# x = [113, 64, 16, 45, 28, 19, 30, 82, 76]
|
337
|
+
# y = [31, 5, 2, 17, 18, 2, 9, 25, 13]
|
338
|
+
# paraTest = Num4TstStatistic2Lib::DecorrTestLib.new
|
339
|
+
# paraTest.spearmanscorr(x, y, 0.05)
|
340
|
+
# => true
|
341
|
+
def spearmanscorr(x, y, a)
|
342
|
+
df = x.size - 2
|
343
|
+
statistic = @nonParaTest.spearmanscorr(x, y)
|
344
|
+
return @hypothTest.twoSideTest(statistic, df, a)
|
345
|
+
end
|
346
|
+
# ケンドールの順位相関係数
|
347
|
+
#
|
348
|
+
# @overload kendallscorr(x, y, a)
|
349
|
+
# @param [Array] x xのデータ(double[])
|
350
|
+
# @param [Array] y yのデータ(double[])
|
351
|
+
# @param [double] a 有意水準
|
352
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
353
|
+
# @example
|
354
|
+
# x = [113, 64, 16, 45, 28, 19, 30, 82, 76]
|
355
|
+
# y = [31, 5, 2, 17, 18, 2, 9, 25, 13]
|
356
|
+
# paraTest = Num4TstStatistic2Lib::DecorrTestLib.new
|
357
|
+
# paraTest.kendallscorr(x, y, 0.05)
|
358
|
+
# => false
|
359
|
+
def kendallscorr(x, y, a)
|
360
|
+
df = x.size - 2
|
361
|
+
statistic = @nonParaTest.kendallscorr(x, y)
|
362
|
+
return @hypothTest.twoSideTest(statistic, df, a)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: num4tststatistic2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- siranovel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: num4tststatistic
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.2.2
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.2.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: num4hypothtst
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.1'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.1.1
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.1'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.1.1
|
53
|
+
description: integration module of num4tststatistic and num4hypothtst
|
54
|
+
email: siranovel@gmail.com
|
55
|
+
executables: []
|
56
|
+
extensions: []
|
57
|
+
extra_rdoc_files: []
|
58
|
+
files:
|
59
|
+
- CHANGELOG.md
|
60
|
+
- Gemfile
|
61
|
+
- LICENSE
|
62
|
+
- lib/num4tststatistic2.rb
|
63
|
+
homepage: http://github.com/siranovel/num4tststatistic2
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubygems_version: 3.3.7
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: statistical hypothesis verification!
|
86
|
+
test_files: []
|