num4normality 0.0.9-java → 0.0.10-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/num4normality/Normality.java +28 -0
- data/lib/num4normality.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc5dd36e009ab6ce0b3a044652184f723ce70b416bab8780d01a56952bcd7b8b
|
4
|
+
data.tar.gz: 46fa3aefe151fb4e6dd8a47a3c4a4e38670704dd74b21a9d6fb19f6a13349a82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9933cc4c22ac645b17ae8e65b835d72fc80453e05c478903d1c748d3ff66615b9a0c631ced2ef4a2c8051297b2da16cdcd73b47d654032ed79599b0ae19f2bf
|
7
|
+
data.tar.gz: c74c186cc3caa4d511f8187ec9b7024d85ae8249d40692942800655c45fda60589be35745cb94659fd7d40038e65d4a0e3cb4ae91ef837d06302a6e180736e6d
|
data/CHANGELOG.md
CHANGED
@@ -94,6 +94,12 @@ public class Normality {
|
|
94
94
|
|
95
95
|
return daigo.test(x, HypothesisTest.P);
|
96
96
|
}
|
97
|
+
public static boolean jbTest(double[] xi) {
|
98
|
+
HypothesisTest daigo = new JBTest();
|
99
|
+
double x = daigo.calcTestStatistic(xi);
|
100
|
+
|
101
|
+
return daigo.test(x, HypothesisTest.P);
|
102
|
+
}
|
97
103
|
/*********************************/
|
98
104
|
/* interface define */
|
99
105
|
/*********************************/
|
@@ -644,5 +650,27 @@ public class Normality {
|
|
644
650
|
return a2 * (1.0 + 0.75 / n + 2.25 / (n * n));
|
645
651
|
}
|
646
652
|
}
|
653
|
+
// Jarque-Bera検定
|
654
|
+
private static class JBTest implements HypothesisTest {
|
655
|
+
private HypothesisTest skewness = null;
|
656
|
+
private HypothesisTest kurtosis = null;
|
657
|
+
public JBTest() {
|
658
|
+
skewness = new SkewnessTest();
|
659
|
+
kurtosis = new KurtosisTest();
|
660
|
+
}
|
661
|
+
public double calcTestStatistic(double[] xi) {
|
662
|
+
int n = xi.length;
|
663
|
+
double x1 = skewness.calcTestStatistic(xi);
|
664
|
+
double x2 = kurtosis.calcTestStatistic(xi);
|
665
|
+
|
666
|
+
return n / 6.0 * (x1 *x1 + x2 * x2 / 4.0);
|
667
|
+
}
|
668
|
+
public boolean test(double statistic, double a) {
|
669
|
+
ChiSquaredDistribution chi2Dist = new ChiSquaredDistribution(2);
|
670
|
+
double p = chi2Dist.cumulativeProbability(statistic);
|
671
|
+
|
672
|
+
return (p < a) ? true : false;
|
673
|
+
}
|
674
|
+
}
|
647
675
|
}
|
648
676
|
|
data/lib/num4normality.rb
CHANGED
@@ -145,6 +145,18 @@ module Num4NormalityLib
|
|
145
145
|
def adtest(xi)
|
146
146
|
Normality.adTest(xi.to_java(Java::double))
|
147
147
|
end
|
148
|
+
# Jarque-Bera検定
|
149
|
+
#
|
150
|
+
# @overload jbtest(xi)
|
151
|
+
# @param [Array] xi データ(double[])
|
152
|
+
# @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
|
153
|
+
# @example
|
154
|
+
# xi = [320, 240, 402, 325, 440, 286, 362, 281, 560, 212, 198, 209, 374]
|
155
|
+
# Num4NormalityLib.jbtest(xi)
|
156
|
+
# => false
|
157
|
+
def jbtest(xi)
|
158
|
+
Normality.jbTest(xi.to_java(Java::double))
|
159
|
+
end
|
148
160
|
end
|
149
161
|
end
|
150
162
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: num4normality
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- siranovel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|