num4normality 0.0.10-java → 0.0.11-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 +29 -6
- 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: e05aa008cb138a008afea68e92fd7df22fa5155f709ac2649e11db122bc28e44
|
4
|
+
data.tar.gz: 011e3a5473bf128c2946cc23126b59ff977b3b4d937b24405baa655a8d7b6b3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fdb7fe9d57d14a3bd0a7584cbd0f19803f651799ab4d3cbdf14d1ed5f057d480cbf274ca086037adfd28402a991e7b07cdb4d13ec29e6b02fde5f6985dd0906
|
7
|
+
data.tar.gz: b311f196404a1bd3e37b084d3dcca33100e36ff1e8ea5df3fc9a986e56e7a008693e9c01993a74bbe26ad9afbdc5b5e5d9110900b78c7be3d2335e3c25f486bb
|
data/CHANGELOG.md
CHANGED
@@ -149,6 +149,7 @@ public class Normality {
|
|
149
149
|
return plotImpl.createPlot(dname, xi);
|
150
150
|
}
|
151
151
|
public static class QQPlot implements CreatePlot {
|
152
|
+
private double xbar = 0.0;
|
152
153
|
private double[][] createData(double[] xi) {
|
153
154
|
DescriptiveStatistics stat = new DescriptiveStatistics();
|
154
155
|
NormalDistribution ndist = new NormalDistribution(0, 1);
|
@@ -159,15 +160,18 @@ public class Normality {
|
|
159
160
|
double sum = stat.getSum();
|
160
161
|
double[][] data = new double[n][2];
|
161
162
|
double p = 0.0;
|
163
|
+
double sumx = 0.0;
|
162
164
|
|
163
165
|
for (int i = 0; i < n; i++) {
|
164
166
|
p += xi[i] / sum;
|
165
167
|
double x =
|
166
168
|
ndist.inverseCumulativeProbability(p * (i + 1.0) / (n + 1.0));
|
167
169
|
|
170
|
+
sumx += x;
|
168
171
|
data[i][0] = x;
|
169
172
|
data[i][1] = xi[i];
|
170
173
|
}
|
174
|
+
xbar = sumx / n;
|
171
175
|
return data;
|
172
176
|
}
|
173
177
|
public XYPlot createPlot(String dname, double[] xi) {
|
@@ -224,16 +228,35 @@ public class Normality {
|
|
224
228
|
XYSeries cu = new XYSeries("累積");
|
225
229
|
|
226
230
|
simpleReg.addData(data);
|
227
|
-
double a = simpleReg.getSlope();
|
228
|
-
double b = simpleReg.getIntercept();
|
229
|
-
|
230
231
|
for (double x = ChartPlot.CLASS_MIN; x < ChartPlot.CLASS_MAX; x += 0.01) {
|
231
|
-
|
232
|
-
|
233
|
-
cu.add(x, y);
|
232
|
+
cu.add(x, simpleReg.predict(x));
|
234
233
|
}
|
234
|
+
// 信頼区間
|
235
|
+
long n = simpleReg.getN();
|
236
|
+
double ve = simpleReg.getMeanSquareError();
|
237
|
+
double sxx = simpleReg.getXSumSquares();
|
238
|
+
TDistribution tDist = new TDistribution(n - 2);
|
239
|
+
double t = tDist.inverseCumulativeProbability(0.975);
|
240
|
+
XYSeries p05m = new XYSeries("P05-");
|
241
|
+
XYSeries p05p = new XYSeries("P05+");
|
242
|
+
|
243
|
+
for(int i = 0; i < n; i++) {
|
244
|
+
double x = data[i][0];
|
245
|
+
double residual = (x - xbar);
|
246
|
+
double interval = t * Math.sqrt(
|
247
|
+
(1 + 1.0 / n + residual * residual / sxx) * ve
|
248
|
+
);
|
249
|
+
double y01 = simpleReg.predict(x) - interval;
|
250
|
+
double y02 = simpleReg.predict(x) + interval;
|
251
|
+
|
252
|
+
p05m.add(x, y01);
|
253
|
+
p05p.add(x, y02);
|
254
|
+
}
|
255
|
+
|
235
256
|
XYSeriesCollection series = new XYSeriesCollection();
|
236
257
|
series.addSeries(cu);
|
258
|
+
series.addSeries(p05m);
|
259
|
+
series.addSeries(p05p);
|
237
260
|
return series;
|
238
261
|
}
|
239
262
|
}
|
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.11
|
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-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|