num4anova 0.0.3-java → 0.0.5-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: 89f91d9c210bb998f14a726f1c7147470cba19fba721724625b7ec87e4c88ad9
4
- data.tar.gz: a79f6e3ca4adc650193065ae62037cfed0580e5f7b9c5e1d06109d74f17a05d6
3
+ metadata.gz: 7a089d52ead2c9726d9ca61db475f128925afddca7cbcf6f65f0da75e41f0b1b
4
+ data.tar.gz: 050e29e04bd0e8272da89d5aba231fe08294f50f090d261da7aa6822f5df5bc5
5
5
  SHA512:
6
- metadata.gz: 97a1409dfb791766292e8d6c0a49502555911529632d45b72aa6c68bc6fda7e82ed813fff4c005c9c76745a2ad05fe79d1131e23879da18afcc88d0652617c29
7
- data.tar.gz: 4cd28879971daf44d20ff8122120327e8a74519f658a22e052724af316387c057cfb315a6d1cb23324bbd08634c066c1045594d6c8804f1f87e12d31b6acd0fb
6
+ metadata.gz: f0cc84d4cebb416b04ed0360ef4cf72799aaebcf70104b6e2d2dc2bc471400d3ac313b71f5885fd0854ae8b3ae22dd66c753066233b1ed2848aabf586cee2c05
7
+ data.tar.gz: 88a74fb295e7ce0e0bdba405a14239a37fac4f3115bd29f358ce7b54fcc3b71a1533ff095e5aea7e2b141d867051eca703d179874f1ed349aef92575d8d0a186
data/CHANGELOG.md CHANGED
@@ -2,10 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.0.5] - 2024-02-01
6
+
7
+ ### add
8
+ - add function of twoway_anova.
9
+
10
+ ## [0.0.4] - 2024-01-30
11
+ ### add
12
+ - add function of replicate_plot
13
+ - add function of replicate_test
14
+
5
15
  ## [0.0.3] - 2024-01-26
6
16
 
7
17
  ### add
8
- - add function of dunnet_test.
18
+ - add function of dunnet_test
9
19
 
10
20
  ## [0.0.2] - 2024-01-23
11
21
 
@@ -249,6 +249,7 @@ public class MultiComp {
249
249
  private double[] n = null;
250
250
  protected int getK() { return k;}
251
251
  protected int getV() { return v;}
252
+
252
253
  public double[][] calcTestStatistic(double[][] xi) {
253
254
  k = xi.length;
254
255
  mean = new double[k];
@@ -267,8 +268,10 @@ public class MultiComp {
267
268
  private double calcVe(double[][] xi) {
268
269
  double sumSq = 0.0;
269
270
  int sumN = 0;
271
+
270
272
  for(int i = 0; i < k; i++) {
271
273
  DescriptiveStatistics stat = new DescriptiveStatistics();
274
+
272
275
  Arrays.stream(xi[i]).forEach(stat::addValue);
273
276
  mean[i] = stat.getMean();
274
277
  n[i] = stat.getN();
@@ -286,7 +289,7 @@ public class MultiComp {
286
289
  int v = super.getV();
287
290
  int k = super.getK();
288
291
  double den = k - 1;
289
- double p = 1.0 - a / den;
292
+
290
293
  TDistribution tDist = new TDistribution(v);
291
294
  double l_val = tDist.inverseCumulativeProbability(a / den);
292
295
  double r_val = tDist.inverseCumulativeProbability(1.0 - a / den);
@@ -28,6 +28,7 @@ import java.util.ArrayList;
28
28
  import org.apache.commons.math3.stat.inference.OneWayAnova;
29
29
  import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
30
30
  import org.apache.commons.math3.distribution.ChiSquaredDistribution;
31
+ import org.apache.commons.math3.distribution.FDistribution;
31
32
  import java.util.Map;
32
33
  public class OneWayLayout {
33
34
  private static OneWayLayout oneWay = new OneWayLayout();
@@ -57,7 +58,19 @@ public class OneWayLayout {
57
58
  OneWayAnovaTest oneway = new BartletTest();
58
59
 
59
60
  double statistic = oneway.calcTestStatistic(xi);
60
- return oneway.test(statistic, a);
61
+ return oneway.execute_test(statistic, a);
62
+ }
63
+ public void replicatePlot(String dname, Map<String, double[]> vals) {
64
+ ChartPlot plot = new ReplicateChartPlot();
65
+
66
+ JFreeChart chart = plot.createChart("反復測定", dname, vals);
67
+ plot.writeJPEG("replicate.jpeg", chart, 800, 500);
68
+ }
69
+ public boolean replicateTest(double[][] xi, double a) {
70
+ OneWayAnovaTest oneway = new ReplicateTest();
71
+
72
+ double statistic = oneway.calcTestStatistic(xi);
73
+ return oneway.execute_test(statistic, a);
61
74
  }
62
75
  /*********************************/
63
76
  /* interface define */
@@ -78,7 +91,7 @@ public class OneWayLayout {
78
91
  }
79
92
  private interface OneWayAnovaTest {
80
93
  double calcTestStatistic(double[][] xi);
81
- boolean test(double statistic, double a);
94
+ boolean execute_test(double statistic, double a);
82
95
  }
83
96
  /*********************************/
84
97
  /* class define */
@@ -196,6 +209,7 @@ public class OneWayLayout {
196
209
  }
197
210
  }
198
211
  }
212
+ // バートレット検定
199
213
  private class BartletTest implements OneWayAnovaTest {
200
214
  private int n = 0;
201
215
  public double calcTestStatistic(double[][] xi) {
@@ -226,6 +240,7 @@ public class OneWayLayout {
226
240
  double invSumN = 0.0;
227
241
  int sumN = 0;
228
242
  DescriptiveStatistics stat = new DescriptiveStatistics();
243
+
229
244
  for(int i = 0; i < n; i++) {
230
245
  Arrays.stream(xi[i]).forEach(stat::addValue);
231
246
  invSumN += 1.0 / (stat.getN() - 1.0);
@@ -236,12 +251,134 @@ public class OneWayLayout {
236
251
  * (invSumN - 1.0 / (sumN - n));
237
252
  return ln2L / deno;
238
253
  }
239
- public boolean test(double statistic, double a) {
254
+ public boolean execute_test(double statistic, double a) {
240
255
  ChiSquaredDistribution chi2Dist = new ChiSquaredDistribution(n - 1);
241
256
  double r_val = chi2Dist.inverseCumulativeProbability(1.0 - a);
242
257
 
243
258
  return (r_val < statistic) ? true : false;
244
259
  }
245
260
  }
261
+ // 反復測定Plot
262
+ private class ReplicateChartPlot implements ChartPlot {
263
+ public JFreeChart createChart(String title, String dname, Map<String, double[]> vals) {
264
+ CategoryPlot plot = createPlot(dname, vals);
265
+ ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
266
+ JFreeChart chart = new JFreeChart(title, plot);
267
+
268
+ ChartUtils.applyCurrentTheme(chart);
269
+ return chart;
270
+ }
271
+ private CategoryPlot createPlot( String dname, Map<String, double[]> vals) {
272
+ CreatePlot plotImpl = new ReplicatePlot();
273
+
274
+ return plotImpl.createPlot(dname, vals);
275
+ }
276
+ private class ReplicatePlot implements CreatePlot {
277
+ public CategoryPlot createPlot(String dname, Map<String, double[]> vals) {
278
+ LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, true);
279
+
280
+ renderer.setDefaultToolTipGenerator(
281
+ new StandardCategoryToolTipGenerator()
282
+ );
283
+ CategoryPlot plot = new CategoryPlot();
284
+
285
+ plot.setOrientation(PlotOrientation.VERTICAL);
286
+ plot.mapDatasetToRangeAxis(0,0);
287
+ plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
288
+
289
+ /*--- 横軸 ---*/
290
+ CategoryAxis categoryAxis = new CategoryAxis("因子");
291
+ plot.setDomainAxis(categoryAxis);
292
+
293
+ /*--- 縦軸 ---*/
294
+ NumberAxis valueAxis0 = new NumberAxis("推定周辺平均");
295
+ plot.setRangeAxis(valueAxis0);
296
+
297
+ plot.setRenderer(0, renderer);
298
+ plot.setDataset(0, createDataset(dname, vals));
299
+ return plot;
300
+ }
301
+ private CategoryDataset createDataset(String dname, Map<String, double[]> vals) {
302
+ DefaultCategoryDataset data = new DefaultCategoryDataset();
303
+ DescriptiveStatistics stat = new DescriptiveStatistics();
304
+
305
+ for(Map.Entry<String, double[]> entry : vals.entrySet()) {
306
+ double[] v = entry.getValue();
307
+
308
+ Arrays.stream(v).forEach(stat::addValue);
309
+ data.addValue(stat.getMean(), dname, entry.getKey());
310
+ stat.clear();
311
+ }
312
+ return data;
313
+ }
314
+ }
315
+ }
316
+ private class ReplicateTest implements OneWayAnovaTest {
317
+ private int a1 = 0;
318
+ private int b1 = 0;
319
+ public double calcTestStatistic(double[][] xi) {
320
+ b1 = xi[0].length;
321
+ a1 = xi.length;
322
+ double st = calcSt(xi, a1, b1);
323
+ double sa = calcSa(xi, a1, b1);
324
+ double sb = calcSb(xi, a1, b1);
325
+ double se = st - sa - sb;
326
+ double meanSa = sa / (a1 - 1);
327
+ double meanSe = se / ((a1 - 1) * (b1 - 1));
328
+
329
+ return meanSa / meanSe ;
330
+ }
331
+ private double calcSt(double[][] xi, int a, int b) {
332
+ DescriptiveStatistics stat = new DescriptiveStatistics();
333
+ double sumSt1 = 0.0;
334
+ double sumSt2 = 0.0;
335
+
336
+ for(int i = 0; i < a; i++) {
337
+ Arrays.stream(xi[i]).forEach(stat::addValue);
338
+ sumSt1 += stat.getSumsq();
339
+ sumSt2 += stat.getSum();
340
+ stat.clear();
341
+ }
342
+ return sumSt1 - sumSt2 * sumSt2 / (a * b);
343
+ }
344
+ private double calcSa(double[][] xi, int a, int b) {
345
+ double sumSa1 = 0.0;
346
+ double sumSa2 = 0.0;
347
+ double[] an = new double[a];
348
+
349
+ for(int i = 0; i < a; i++) {
350
+ for(int j = 0; j < b; j++) {
351
+ an[i] += xi[i][j];
352
+ sumSa2 += xi[i][j];
353
+ }
354
+ }
355
+ DescriptiveStatistics stat = new DescriptiveStatistics();
356
+ Arrays.stream(an).forEach(stat::addValue);
357
+ sumSa1 = stat.getSumsq() / b;
358
+ return sumSa1 - sumSa2 * sumSa2 / (a * b);
359
+ }
360
+ private double calcSb(double[][] xi, int a, int b) {
361
+ double[] bn = new double[b];
362
+ double sumSb1 = 0.0;
363
+ double sumSb2 = 0.0;
364
+
365
+ for(int i = 0; i < a; i++) {
366
+ for(int j = 0; j < b; j++) {
367
+ bn[j] += xi[i][j];
368
+ sumSb2 += xi[i][j];
369
+ }
370
+ }
371
+ DescriptiveStatistics stat = new DescriptiveStatistics();
372
+ Arrays.stream(bn).forEach(stat::addValue);
373
+ sumSb1 = stat.getSumsq() / a;
374
+ return sumSb1 - sumSb2 * sumSb2 / (a * b);
375
+ }
376
+ public boolean execute_test(double statistic, double a) {
377
+ FDistribution fDist = new FDistribution(a1 - 1, (a1 - 1) * (b1 - 1));
378
+ double f = fDist.inverseCumulativeProbability(1.0 - a);
379
+
380
+ return (statistic >= f) ? true : false;
381
+ }
382
+ }
246
383
  }
247
384
 
@@ -0,0 +1,186 @@
1
+ import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
2
+ import org.apache.commons.math3.distribution.FDistribution;
3
+ import java.util.Arrays;
4
+ public class TwoWayLayout {
5
+ private static TwoWayLayout twoWay = new TwoWayLayout();
6
+ public static TwoWayLayout getInstance() {
7
+ return twoWay;
8
+ }
9
+ public boolean[] twowayAnova(double[][][] xij, double a) {
10
+ TwoWayAnovaTest twoway = new TwoWayAnova();
11
+
12
+ double[] statistic = twoway.calcTestStatistic(xij);
13
+ return twoway.execute_test(statistic, a);
14
+ }
15
+ /*********************************/
16
+ /* interface define */
17
+ /*********************************/
18
+ private interface TwoWayAnovaTest {
19
+ double[] calcTestStatistic(double[][][] xij);
20
+ boolean[] execute_test(double statistic[], double a);
21
+ }
22
+ /*********************************/
23
+ /* class define */
24
+ /*********************************/
25
+ private class TwoWayAnova implements TwoWayAnovaTest {
26
+ private int a = 0;
27
+ private int b = 0;
28
+ private int n = 0;
29
+ private int an = 0;
30
+ private int bn = 0;
31
+ private int abn = 0;
32
+ private int en = 0;
33
+ public double[] calcTestStatistic(double[][][] xij) {
34
+ double statistic[] = new double[3];
35
+ a = xij.length;
36
+ b = xij[0].length;
37
+ n = xij[0][0].length;
38
+ an = a- 1;
39
+ bn = b - 1;
40
+ abn = (a- 1) * (b - 1);
41
+ en = a * b * (n - 1);
42
+
43
+ double[][] meanXij = calcMeanXij(xij);
44
+ double[] meanAn = calcMeanAn(meanXij);
45
+ double[] meanBn = calcMeanBn(meanXij);
46
+ double meanABn = calcMeanABn(meanAn);
47
+
48
+ double allDrift = calcAllDrift(xij, meanABn); // 全変動
49
+ double anDrift = calcAnDrift(meanAn, meanABn); // 水準Ai間変動
50
+ double bnDrift = calcBnDrift(meanBn, meanABn); // 水準Bj間変動
51
+ // 交互作用の変動
52
+ double interaDrift = calcInteraDrift(meanXij, meanAn, meanBn, meanABn);
53
+ double benchDrift = calcBenchDrift(xij, meanXij); // 水準内変動
54
+ double va = b * n * anDrift / an;
55
+ double vb = a * n * bnDrift / bn;
56
+ double vab = n * interaDrift / abn;
57
+ double ve = benchDrift / en;
58
+
59
+ statistic[0] = va / ve;
60
+ statistic[1] = vb / ve;
61
+ statistic[2] = vab/ ve;
62
+ return statistic;
63
+ }
64
+ private double[][] calcMeanXij(double[][][] xij) {
65
+ DescriptiveStatistics stat = new DescriptiveStatistics();
66
+ double[][] meanXij = new double[a][b];
67
+
68
+ for(int i = 0; i < a; i++) {
69
+ for(int j = 0; j < b; j++) {
70
+ Arrays.stream(xij[i][j]).forEach(stat::addValue);
71
+ meanXij[i][j] = stat.getMean();
72
+ stat.clear();
73
+ }
74
+ }
75
+ return meanXij;
76
+ }
77
+ private double[] calcMeanAn(double[][] meanXij) {
78
+ double[] an = new double[a];
79
+ DescriptiveStatistics stat = new DescriptiveStatistics();
80
+
81
+ for(int i = 0; i < a; i++) {
82
+ double sumSa = 0.0;
83
+ for(int j = 0; j < b; j++) {
84
+ sumSa += meanXij[i][j];
85
+ }
86
+ an[i] = sumSa / b;
87
+ }
88
+ return an;
89
+ }
90
+ private double[] calcMeanBn(double[][] meanXij) {
91
+ double[] bn = new double[b];
92
+ double[] sumA = new double[b];
93
+
94
+ for(int i = 0; i < a; i++) {
95
+ for(int j = 0; j < b; j++) {
96
+ bn[j] += meanXij[i][j] / a;
97
+ }
98
+ }
99
+ return bn;
100
+ }
101
+ private double calcMeanABn(double[] meanAn) {
102
+ DescriptiveStatistics stat = new DescriptiveStatistics();
103
+
104
+ Arrays.stream(meanAn).forEach(stat::addValue);
105
+ return stat.getMean();
106
+ }
107
+ // 全変動
108
+ private double calcAllDrift(double[][][] xij, double meanABn) {
109
+ double sumDrift = 0.0;
110
+
111
+ for(int i = 0; i < a; i++) {
112
+ for(int j = 0; j < b; j++) {
113
+ for(int k = 0; k < xij[i][j].length; k++) {
114
+ double diffXijk = xij[i][j][k] - meanABn;
115
+ sumDrift += diffXijk * diffXijk;
116
+ }
117
+ }
118
+ }
119
+ return sumDrift;
120
+ }
121
+ // 水準Ai間変動
122
+ private double calcAnDrift(double[] meanAn, double meanABn) {
123
+ double sumDrift = 0.0;
124
+
125
+ for(int i =0; i < meanAn.length; i++) {
126
+ double diffXi = meanAn[i] - meanABn;
127
+
128
+ sumDrift += diffXi * diffXi;
129
+ }
130
+ return sumDrift;
131
+ }
132
+ // 水準Bj間変動
133
+ private double calcBnDrift(double[] meanBn, double meanABn) {
134
+ double sumDrift = 0.0;
135
+
136
+ for(int j = 0; j < meanBn.length; j++) {
137
+ double diffXj = meanBn[j] - meanABn;
138
+
139
+ sumDrift += diffXj * diffXj;
140
+ }
141
+ return sumDrift;
142
+ }
143
+ // 交互作用の変動
144
+ private double calcInteraDrift(double[][] meanXij, double[] meanAn, double[] meanBn, double meanABn) {
145
+ double sumDrift = 0.0;
146
+
147
+ for(int i = 0; i< a; i++) {
148
+ for(int j = 0; j < b; j++) {
149
+ double diffXj = meanXij[i][j] - meanAn[i] - meanBn[j] + meanABn;
150
+
151
+ sumDrift += diffXj * diffXj;
152
+ }
153
+ }
154
+ return sumDrift;
155
+ }
156
+ // 水準内変動
157
+ private double calcBenchDrift(double[][][] xij, double[][] meanXij) {
158
+ double sumDrift = 0.0;
159
+
160
+ for(int i = 0; i < a; i++) {
161
+ for(int j = 0; j < b; j++) {
162
+ for(int k = 0; k < xij[i][j].length; k++) {
163
+ double diffXj = xij[i][j][k] - meanXij[i][j];
164
+
165
+ sumDrift += diffXj * diffXj;
166
+ }
167
+ }
168
+ }
169
+ return sumDrift;
170
+ }
171
+ public boolean[] execute_test(double statistic[], double a) {
172
+ boolean[] ret = new boolean[3];
173
+
174
+ ret[0] = evaluation(new FDistribution(an, en), statistic[0], a);
175
+ ret[1] = evaluation(new FDistribution(bn, en), statistic[1], a);
176
+ ret[2] = evaluation(new FDistribution(abn, en), statistic[2], a);
177
+ return ret;
178
+ }
179
+ private boolean evaluation(FDistribution fDist, double statistic, double a) {
180
+ double r_val = fDist.inverseCumulativeProbability(1.0 - a);
181
+
182
+ return (statistic < r_val) ? false : true;
183
+ }
184
+ }
185
+ }
186
+
data/lib/num4anova.rb CHANGED
@@ -4,6 +4,7 @@ require 'jfreechart-1.5.4.jar'
4
4
  require 'commons-math3-3.6.1.jar'
5
5
 
6
6
  java_import 'OneWayLayout'
7
+ java_import 'TwoWayLayout'
7
8
  java_import 'java.util.HashMap'
8
9
  # 分散分析を行う
9
10
  # (Apache commoms math3使用)
@@ -72,13 +73,13 @@ module Num4AnovaLib
72
73
  # @param [double] a 有意水準
73
74
  # @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
74
75
  # @example
75
- # xi = [
76
- # [12.2, 18.8, 18.2],
77
- # [22.2, 20.5, 14.6],
78
- # [20.8, 19.5, 26.3],
79
- # [26.4, 32.5, 31.3],
80
- # [24.5, 21.2, 22.4],
81
- # ]
76
+ # xi = [
77
+ # [12.2, 18.8, 18.2],
78
+ # [22.2, 20.5, 14.6],
79
+ # [20.8, 19.5, 26.3],
80
+ # [26.4, 32.5, 31.3],
81
+ # [24.5, 21.2, 22.4],
82
+ # ]
82
83
  # oneWay = Num4AnovaLib::OneWayLayoutLib.new
83
84
  # oneWay.oneWay.oneway_anova(xi, 0.05)
84
85
  # => true
@@ -92,19 +93,107 @@ module Num4AnovaLib
92
93
  # @param [double] a 有意水準
93
94
  # @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
94
95
  # @example
95
- # xi = [
96
- # [12.2, 18.8, 18.2],
97
- # [22.2, 20.5, 14.6],
98
- # [20.8, 19.5, 26.3],
99
- # [26.4, 32.5, 31.3],
100
- # [24.5, 21.2, 22.4],
101
- # ]
96
+ # xi = [
97
+ # [12.2, 18.8, 18.2],
98
+ # [22.2, 20.5, 14.6],
99
+ # [20.8, 19.5, 26.3],
100
+ # [26.4, 32.5, 31.3],
101
+ # [24.5, 21.2, 22.4],
102
+ # ]
102
103
  # oneWay = Num4AnovaLib::OneWayLayoutLib.new
103
104
  # oneWay.bartlet(xi, 0.05)
104
105
  # => true
105
106
  def bartlet(xi, a)
106
107
  return @oneWay.bartletTest(xi.to_java(Java::double[]), a)
107
108
  end
109
+ # 反復測定Plot
110
+ #
111
+ # @overload replicate_plot(dname, vals)
112
+ # @param [String] dname データ名
113
+ # @param [Hash] vals Hash(String, double[])
114
+ # @return [void] replicate.jpegファイルを出力
115
+ # @example
116
+ # vals = {
117
+ # "stageA1" => [27, 52, 18, 21, 32],
118
+ # "stageA2" => [52, 72, 31, 50, 45],
119
+ # "stageA3" => [47, 54, 29, 43, 32],
120
+ # "stageA4" => [28, 50, 22, 26, 29],
121
+ # }
122
+ # oneWay = Num4AnovaLib::OneWayLayoutLib.new
123
+ # oneWay.replicate_plot("LDH", vals)
124
+ # => replicate.jpeg
125
+ # @note
126
+ # グラフは、jfreechartを使用
127
+ def replicate_plot(dname, vals)
128
+ o = HashMap.new
129
+ vals.each{|k, v|
130
+ o[k] = v.to_java(Java::double)
131
+ }
132
+ return @oneWay.replicatePlot(dname, o)
133
+ end
134
+ # 反復測定検定
135
+ #
136
+ # @overload replicate_test(xi, a)
137
+ # @param [array] xi データ(double[][])
138
+ # @param [double] a 有意水準
139
+ # @return [boolean] 検定結果(true:棄却域内 false:棄却域外)
140
+ # @example
141
+ # xi = [
142
+ # [27, 52, 18, 21, 32],
143
+ # [52, 72, 31, 50, 45],
144
+ # [47, 54, 29, 43, 32],
145
+ # [28, 50, 22, 26, 29],
146
+ # ]
147
+ # oneWay = Num4AnovaLib::OneWayLayoutLib.new
148
+ # oneWay.replicate_test(xi, 0.05)
149
+ # => true
150
+ def replicate_test(xi, a)
151
+ return @oneWay.replicateTest(xi.to_java(Java::double[]), a)
152
+ end
153
+ end
154
+
155
+ # 二元配置の分散分析
156
+ class TwoWayLayoutLib
157
+ def initialize
158
+ @twoWay = TwoWayLayout.getInstance()
159
+ end
160
+ # 二元配置の分散分析
161
+ #
162
+ # @overload twoway_anova(xij, a)
163
+ # @param [array] xij データ(double[][][])
164
+ # @param [double] a 有意水準
165
+ # @return [Array] 検定結果(boolean[] true:棄却域内 false:棄却域外)
166
+ # @example
167
+ # xij = [
168
+ # [
169
+ # [13.2, 15.7, 11.9],
170
+ # [16.1, 15.7, 15.1],
171
+ # [9.1, 10.3, 8.2],
172
+ # ],
173
+ # [
174
+ # [22.8, 25.7, 18.5],
175
+ # [24.5, 21.2, 24.2],
176
+ # [11.9, 14.3, 13.7],
177
+ # ],
178
+ # [
179
+ # [21.8, 26.3, 32.1],
180
+ # [26.9, 31.3, 28.3],
181
+ # [15.1, 13.6, 16.2],
182
+ # ],
183
+ # [
184
+ # [25.7, 28.8, 29.5],
185
+ # [30.1, 33.8, 29.6],
186
+ # [15.2, 17.3, 14.8],
187
+ # ],
188
+ # ]
189
+ # twoWay = Num4AnovaLib::TwoWayLayoutLib.new
190
+ # twoWay.twoway_anova(xij, 0.05)
191
+ # =>
192
+ # [true, true, true]
193
+ def twoway_anova(xij, a)
194
+ ret = @twoWay.twowayAnova(xij.to_java(Java::double[][]), a)
195
+ return ret.to_a
196
+ end
108
197
  end
109
198
  end
110
199
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: num4anova
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
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-26 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -63,6 +63,7 @@ files:
63
63
  - Rakefile
64
64
  - ext/num4anova/MultiComp.java
65
65
  - ext/num4anova/OneWayLayout.java
66
+ - ext/num4anova/TwoWayLayout.java
66
67
  - lib/commons-math3-3.6.1.jar
67
68
  - lib/dunnet.rb
68
69
  - lib/jcommon-1.0.23.jar