num4normality 0.0.7-java → 0.0.8-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 +5 -0
- data/ext/num4normality/Normality.java +8 -19
- data/lib/num4normality.rb +2 -2
- 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: 6bdb8267fad8c0c825bffbdc4ce48f03b5f7044b42c7b4575acd0c3bd1d24485
|
4
|
+
data.tar.gz: '0299ec982c1d8c30ee2613f2511d13125c95fb3113ccc48e630ad9496485f92b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d1bb2fb5de97f2480715cff1b0183ff22cf7f04f2d776050edf32f49377bd9dce4b6d48eacdbcde1fe1a67118dcc1e21b1232d84f582a9f65fa695528ca9f5
|
7
|
+
data.tar.gz: 15d6d2d3bbd2b18361064577273fdb66f43f906ebfa87f9671cc31e9a1a11e3203f16b3c828fe828c87aacfcb9be3663370e6249992bf222eb1265109ea6c038
|
data/CHANGELOG.md
CHANGED
@@ -22,6 +22,7 @@ import java.io.File;
|
|
22
22
|
import java.io.IOException;
|
23
23
|
|
24
24
|
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
25
|
+
import org.apache.commons.math3.stat.StatUtils;
|
25
26
|
import org.apache.commons.math3.distribution.NormalDistribution;
|
26
27
|
import org.apache.commons.math3.distribution.ChiSquaredDistribution;
|
27
28
|
import org.apache.commons.math3.stat.regression.SimpleRegression;
|
@@ -237,15 +238,14 @@ public class Normality {
|
|
237
238
|
int n = xi.length;
|
238
239
|
Arrays.sort(xi);
|
239
240
|
Arrays.stream(xi).forEach(stat::addValue);
|
240
|
-
double m = stat.getMean(); // 平均
|
241
|
-
double sd = stat.getStandardDeviation();// 標準偏差
|
242
241
|
double sum = stat.getSum();
|
243
242
|
double[][] data = new double[n][2];
|
244
243
|
double p = 0.0;
|
244
|
+
double z[] = StatUtils.normalize(xi);
|
245
245
|
|
246
246
|
for (int i = 0; i < n; i++) {
|
247
247
|
p += xi[i] / sum;
|
248
|
-
data[i][0] =
|
248
|
+
data[i][0] = z[i];
|
249
249
|
data[i][1] = p;
|
250
250
|
}
|
251
251
|
return data;
|
@@ -364,20 +364,17 @@ public class Normality {
|
|
364
364
|
NormalDistribution ndist = new NormalDistribution(0, 1);
|
365
365
|
|
366
366
|
int n = xi.length;
|
367
|
+
double[][] data = new double[n][2];
|
367
368
|
Arrays.sort(xi);
|
368
369
|
Arrays.stream(xi).forEach(stat::addValue);
|
369
|
-
double m = stat.getMean(); // 平均
|
370
|
-
double sd = stat.getStandardDeviation();// 標準偏差
|
371
370
|
double sum = stat.getSum();
|
372
|
-
double[][] data = new double[n][2];
|
373
371
|
double p = 0.0;
|
372
|
+
double z[] = StatUtils.normalize(xi);
|
374
373
|
|
375
374
|
for (int i = 0; i < n; i++) {
|
376
375
|
p += xi[i] / sum;
|
377
|
-
double x = (xi[i] - m) / sd;
|
378
376
|
|
379
|
-
ndist.cumulativeProbability(
|
380
|
-
data[i][0] = ndist.cumulativeProbability(x);
|
377
|
+
data[i][0] = ndist.cumulativeProbability(z[i]);
|
381
378
|
data[i][1] = p;
|
382
379
|
}
|
383
380
|
return data;
|
@@ -485,19 +482,11 @@ public class Normality {
|
|
485
482
|
// KS検定
|
486
483
|
private static class KSTest {
|
487
484
|
public boolean test(double[] xi) {
|
488
|
-
double[] data = new double[xi.length];
|
489
485
|
Arrays.sort(xi);
|
490
|
-
DescriptiveStatistics stat = new DescriptiveStatistics();
|
491
|
-
Arrays.stream(xi).forEach(stat::addValue);
|
492
|
-
double m = stat.getMean(); // 平均
|
493
|
-
double sd = stat.getStandardDeviation();// 標準偏差
|
494
486
|
NormalDistribution ndist = new NormalDistribution(0, 1);
|
487
|
+
double data[] = StatUtils.normalize(xi);
|
495
488
|
|
496
|
-
|
497
|
-
data[i] = (xi[i] - m) / sd;
|
498
|
-
}
|
499
|
-
boolean ret = TestUtils.kolmogorovSmirnovTest(ndist, data, 0.05);
|
500
|
-
return ret;
|
489
|
+
return TestUtils.kolmogorovSmirnovTest(ndist, data, 0.05);
|
501
490
|
}
|
502
491
|
}
|
503
492
|
// タコスディーノ検定(歪度)
|
data/lib/num4normality.rb
CHANGED
@@ -33,7 +33,7 @@ module Num4NormalityLib
|
|
33
33
|
# @example
|
34
34
|
# xi = [320, 240, 402, 325, 440, 286, 362, 281, 560, 212, 198, 209, 374]
|
35
35
|
# Num4NormalityLib.ksplot("LDH", xi)
|
36
|
-
# =>
|
36
|
+
# => ksplot.jpeg
|
37
37
|
# @note
|
38
38
|
# グラフは、jfreechartを使用
|
39
39
|
def ksplot(dname, xi)
|
@@ -74,7 +74,7 @@ module Num4NormalityLib
|
|
74
74
|
# @overload ppksplot(dname, xi)
|
75
75
|
# @param [String] dname データ名
|
76
76
|
# @param [Array] xi データ(double[])
|
77
|
-
# @return [void]
|
77
|
+
# @return [void] ppksplot.jpegファイルを出力
|
78
78
|
# @example
|
79
79
|
# xi = [320, 240, 402, 325, 440, 286, 362, 281, 560, 212, 198, 209, 374]
|
80
80
|
# Num4NormalityLib.ppksplot("LDH", xi)
|
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.8
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- siranovel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|