num4hypothtst 0.0.7-java → 0.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddedb6b175ca41c15b5ebe6328faaa1cb05bfac2ca7098147960cdb4ab952dfd
4
- data.tar.gz: a42501c4c92de4bbcffb5c7da8be7098101d890d947fbc98ec4e486be6122f7e
3
+ metadata.gz: 432a4cbc15fba13f8984908b8f8a94e5778940a3e075fe89ea8ba8dc1e07033b
4
+ data.tar.gz: a14a0c31508cc5e140da1b0b7547fc3d19f9e351f3e25ddab6b5a4140b3c9fd1
5
5
  SHA512:
6
- metadata.gz: 1cea2d82655c054806b9a021503a4966e9e1bbf12937e09be304e4ecc95f84004d3680920373a3891bbb9b44941623993c921bcf127bca7f821f0247cbec7356
7
- data.tar.gz: a9b38cb24b307f86284075791454ec5b5452abeaa7d010b6711adda1d08c6f52fe5800f16c40e5025ab8669859df58364801e4d26010d658d63ed63b7dad54d6
6
+ metadata.gz: 4927b6d67b0b12ae13553db12ebd14c3d77895cca6e1bb122b35321f1966eb6025d38a59663ca750283318d0d226936e0abe162c3bfe6db18cfb0a9f9c0b69fc
7
+ data.tar.gz: 7a2113d7dd28c06022ade72e4600038d66ea459a5e2a012ed1ffb770dc29bc628326cfa7d68a9e2f97e4709a74fe6b5472cc835380680348cc1e8fab97892729
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.1.1] - 2024-04-17
6
+
7
+ ### add
8
+ - add intercase HypothTest3IF.
9
+
10
+ ## [0.0.8] - 2024-01-19
11
+
12
+ ### change
13
+ - change function of populationCorre.
14
+
5
15
  ## [0.0.7] - 2024-01-08
6
16
 
7
17
  ### change
@@ -7,6 +7,17 @@ interface HypothTest3 {
7
7
  boolean normDistTest(double statistic, double a);
8
8
  boolean fDistTest(double statistic, double nf, double df, double a);
9
9
 
10
- boolean populationCorre(double r, int n, double rth0, double a);
10
+ default boolean populationCorre(double r, int n, double rth0, double a) {
11
+ return normDistTest(populaCorrStatistic(r, n, rth0), a);
12
+ }
13
+ private double populaCorrStatistic(double r, int n, double rth0) {
14
+ double statistic = Math.sqrt(n-3.0) *
15
+ (
16
+ 0.5 * Math.log((1.0 + r) / (1.0 - r))
17
+ - 0.5 * Math.log((1.0 + rth0) / (1.0 - rth0))
18
+ );
19
+
20
+ return statistic;
21
+ }
11
22
  }
12
23
 
@@ -35,15 +35,6 @@ public class LeftSideTest implements HypothTest3 {
35
35
 
36
36
  return evaluation(statistic, l_val);
37
37
  }
38
- public boolean populationCorre(double r, int n, double rth0, double a) {
39
- double statistic = Math.sqrt(n-3.0) *
40
- (
41
- 0.5 * Math.log((1.0 + r) / (1.0 - r))
42
- - 0.5 * Math.log((1.0 + rth0) / (1.0 - rth0))
43
- );
44
-
45
- return normDistTest(statistic, a);
46
- }
47
38
 
48
39
  private boolean evaluation(double statistic, double l_val) {
49
40
  boolean ret = true;
@@ -34,15 +34,6 @@ public class RightSideTest implements HypothTest3 {
34
34
 
35
35
  return evaluation(statistic, r_val);
36
36
  }
37
- public boolean populationCorre(double r, int n, double rth0, double a) {
38
- double statistic = Math.sqrt(n-3.0) *
39
- (
40
- 0.5 * Math.log((1.0 + r) / (1.0 - r))
41
- - 0.5 * Math.log((1.0 + rth0) / (1.0 - rth0))
42
- );
43
-
44
- return normDistTest(statistic, a);
45
- }
46
37
 
47
38
  private boolean evaluation(double statistic, double r_val) {
48
39
  boolean ret = true;
@@ -39,15 +39,6 @@ public class TwoSideTest implements HypothTest3 {
39
39
 
40
40
  return evaluation(statistic, l_val, r_val);
41
41
  }
42
- public boolean populationCorre(double r, int n, double rth0, double a) {
43
- double statistic = Math.sqrt(n-3.0) *
44
- (
45
- 0.5 * Math.log((1.0 + r) / (1.0 - r))
46
- - 0.5 * Math.log((1.0 + rth0) / (1.0 - rth0))
47
- );
48
-
49
- return normDistTest(statistic, a);
50
- }
51
42
 
52
43
  private boolean evaluation(double statistic, double l_val, double r_val) {
53
44
  boolean ret = true;
@@ -0,0 +1,17 @@
1
+ class HypothTest3IF
2
+ def tDistTest(statistic, df, a)
3
+ raise NotImplementedError.new("#{self.class}##{__method__} が実装されていません")
4
+ end
5
+ def chi2DistTest(statistic, df, a)
6
+ raise NotImplementedError.new("#{self.class}##{__method__} が実装されていません")
7
+ end
8
+ def normDistTest(statistic, a)
9
+ raise NotImplementedError.new("#{self.class}##{__method__} が実装されていません")
10
+ end
11
+ def fDistTest(statistic, nf, df, a)
12
+ raise NotImplementedError.new("#{self.class}##{__method__} が実装されていません")
13
+ end
14
+ def populationCorre(r, n, rth0)
15
+ raise NotImplementedError.new("#{self.class}##{__method__} が実装されていません")
16
+ end
17
+ end
data/lib/num4hypothtst.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'java'
2
2
  require 'num4hypothtst.jar'
3
3
  require 'commons-math3-3.6.1.jar'
4
+ require_relative('hypothTest3')
4
5
 
5
6
  java_import 'hypothtst.TwoSideTest'
6
7
  java_import 'hypothtst.RightSideTest'
@@ -12,7 +13,7 @@ java_import 'hypothtst.DecorrTest'
12
13
  # (Apache commoms math3使用)
13
14
  module Num4HypothTestLib
14
15
  # 両側検定
15
- class TwoSideTestLib
16
+ class TwoSideTestLib < HypothTest3IF
16
17
  def initialize
17
18
  @hypothTest3 = TwoSideTest.getInstance()
18
19
  end
@@ -71,7 +72,7 @@ module Num4HypothTestLib
71
72
  end
72
73
  end
73
74
  # 片側(右側)検定
74
- class RightSideTestLib
75
+ class RightSideTestLib < HypothTest3IF
75
76
  def initialize
76
77
  @hypothTest3 = RightSideTest.getInstance()
77
78
  end
@@ -130,7 +131,7 @@ module Num4HypothTestLib
130
131
  end
131
132
  end
132
133
  # 片側(左側)検定
133
- class LeftSideTestLib
134
+ class LeftSideTestLib < HypothTest3IF
134
135
  def initialize
135
136
  @hypothTest3 = LeftSideTest.getInstance()
136
137
  end
@@ -181,6 +182,7 @@ module Num4HypothTestLib
181
182
  # @param [double] r 標本相関係数
182
183
  # @param [int] n 自由度
183
184
  # @param [double] rth0 母相関係数
185
+ # @param [double] a 有意水準
184
186
  # @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
185
187
  # @note
186
188
  # 標準正規分布 N(0,1*1)に従う(近似的)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: num4hypothtst
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - siranovel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -70,6 +70,7 @@ files:
70
70
  - ext/num4hypothtst/hypothtst/RightSideTest.java
71
71
  - ext/num4hypothtst/hypothtst/TwoSideTest.java
72
72
  - lib/commons-math3-3.6.1.jar
73
+ - lib/hypothTest3.rb
73
74
  - lib/num4hypothtst.rb
74
75
  homepage: http://github.com/siranovel/num4hypothtst
75
76
  licenses: