num4normality 0.0.10-java → 0.0.11-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc5dd36e009ab6ce0b3a044652184f723ce70b416bab8780d01a56952bcd7b8b
4
- data.tar.gz: 46fa3aefe151fb4e6dd8a47a3c4a4e38670704dd74b21a9d6fb19f6a13349a82
3
+ metadata.gz: e05aa008cb138a008afea68e92fd7df22fa5155f709ac2649e11db122bc28e44
4
+ data.tar.gz: 011e3a5473bf128c2946cc23126b59ff977b3b4d937b24405baa655a8d7b6b3f
5
5
  SHA512:
6
- metadata.gz: f9933cc4c22ac645b17ae8e65b835d72fc80453e05c478903d1c748d3ff66615b9a0c631ced2ef4a2c8051297b2da16cdcd73b47d654032ed79599b0ae19f2bf
7
- data.tar.gz: c74c186cc3caa4d511f8187ec9b7024d85ae8249d40692942800655c45fda60589be35745cb94659fd7d40038e65d4a0e3cb4ae91ef837d06302a6e180736e6d
6
+ metadata.gz: 8fdb7fe9d57d14a3bd0a7584cbd0f19803f651799ab4d3cbdf14d1ed5f057d480cbf274ca086037adfd28402a991e7b07cdb4d13ec29e6b02fde5f6985dd0906
7
+ data.tar.gz: b311f196404a1bd3e37b084d3dcca33100e36ff1e8ea5df3fc9a986e56e7a008693e9c01993a74bbe26ad9afbdc5b5e5d9110900b78c7be3d2335e3c25f486bb
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.0.11] - 2024-06-05
6
+ ### add
7
+ - add fiducial interval in qqplot.
8
+
5
9
  ## [0.0.10] - 2024-05-18
6
10
  ### add
7
11
  - add function of jbtest.
@@ -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
- double y = a * x + b;
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.10
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-18 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake