num4anova 0.0.12-java → 0.0.13-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87febfd8031fd924430223c93fad6b0606aa212ab109e1b758db2c1d23b6dace
4
- data.tar.gz: 48b610b93d2c5341f05c25ef230acea09b02fa75c924129f5dafba56fcb6051f
3
+ metadata.gz: 84f7f49327e10a3da88a363daa4d6d5dec1dd4da00827d6f8e5c60ee6db4bc08
4
+ data.tar.gz: 495495a96d218034014971770b654431bb0df61aec47f8f3171fe351285022c4
5
5
  SHA512:
6
- metadata.gz: 979fe122d0cf17086e80a45ff6c44b67153822a8d89d83bceb84a25d3d68190f087c3ed8bf4b192e9afd48a38b3ec0d1456fa0821c84256113154e04d5a6e461
7
- data.tar.gz: 0bcad9f7a234a96759697440f540f0caddf70c1a25cf46409dead11478faa0017cfe9e98d2a23feaad2648bea641d5bca80cb73adab5001ec46d93ef8899ce70
6
+ metadata.gz: 1b46cc7670940eb88343959c80bad55209a981388acdd823c3d9eeafa72a629d2319cfb49707f3f998d72f0d080480785129c948c8ebedb388693476be59add1
7
+ data.tar.gz: 83585b2c13c1f964b8bf92e507a005deb4d358a612e23b939cb9d9911175006a1378e16719c1b73073834aa510f245b4432f0aba9f5dfcdceb78ee2cf5638ba3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.0.13] - 2024-04-04
6
+
7
+ ### chg
8
+ - chg fuction of interval_estim.
9
+
5
10
  ## [0.0.12] - 2024-03-27
6
11
 
7
12
  ### add
@@ -24,7 +24,7 @@ public class Ancova {
24
24
  double statistic = hypoth.calcTestStatistic(xi);
25
25
  return hypoth.executeTest(statistic, a);
26
26
  }
27
- public Interval intervalEstim(double[][][] xi, double a) {
27
+ public Interval[] intervalEstim(double[][][] xi, double a) {
28
28
  Estim estim = new IntervalEstim();
29
29
 
30
30
  return estim.calcInterval(xi, a);
@@ -37,7 +37,7 @@ public class Ancova {
37
37
  boolean executeTest(double statistic, double a);
38
38
  }
39
39
  private interface Estim {
40
- Interval calcInterval(double[][][] xi, double a);
40
+ Interval[] calcInterval(double[][][] xi, double a);
41
41
  }
42
42
  /*********************************/
43
43
  /* class define */
@@ -346,7 +346,8 @@ public class Ancova {
346
346
  private int n = 0;
347
347
  private int[] ni = null;
348
348
  private double sumex = 0.0;
349
- public Interval calcInterval(double[][][] xi, double a) {
349
+ public Interval[] calcInterval(double[][][] xi, double a) {
350
+ Interval[] ret = new Interval[xi.length];
350
351
  ni = calcNi(xi);
351
352
  int sumn = calcSumn(xi);
352
353
  n = sumn - xi.length - 1;
@@ -360,12 +361,16 @@ public class Ancova {
360
361
 
361
362
  TDistribution tDist = new TDistribution(n);
362
363
  double t = tDist.inverseCumulativeProbability(1.0 - a / 2.0);
363
- double wk = (meanxi[0] - meanx);
364
- double wk2 = t * Math.sqrt((1/ni[0] + wk * wk / sumex) * ve);
365
- double min = meanyi[0] - b * wk - wk2;
366
- double max = meanyi[0] - b * wk + wk2;
364
+ for(int i = 0; i < ret.length; i++) {
365
+ double wk = (meanxi[i] - meanx);
366
+ double wk2 = t * Math.sqrt((1/ni[i] + wk * wk / sumex) * ve);
367
+ double min = meanyi[i] - b * wk - wk2;
368
+ double max = meanyi[i] - b * wk + wk2;
367
369
 
368
- return new Interval(min, max);
370
+ ret[i] = new Interval(min, max);
371
+ }
372
+
373
+ return ret;
369
374
  }
370
375
  private int[] calcNi(double[][][] xi) {
371
376
  int[] ni = new int[xi.length];
data/lib/num4anova.rb CHANGED
@@ -341,14 +341,24 @@ module Num4AnovaLib
341
341
  # ancova = Num4AnovaLib::Num4AncovaLib.new
342
342
  # ancova.interval_estim(xi, 0.05)
343
343
  # =>
344
- # {:min=>4.466605469341916, :max=>7.1909253948556096}
344
+ # {:min=>4.466605469341916, :max=>7.1909253948556096}
345
+ # {:min=>5.05699825110459, :max=>6.386335082228742}
346
+ # {:min=>2.510804295684195, :max=>4.250430272217034}
347
+ # {:min=>2.8089257316042135, :max=>2.9566298239513418}
348
+ # {:min=>-6.303283147572267, :max=>-0.6577045067487104}
345
349
  def interval_estim(xi, a)
350
+ retRb = []
346
351
  retJava = @ancova.intervalEstim(xi.to_java(Java::double[][]), a)
347
- retHash = {
348
- "min": retJava.getMin(),
349
- "max": retJava.getMax()
350
- }
351
- return retHash
352
+ sz = retJava.size
353
+ sz.times do |i|
354
+ retRb.push(
355
+ {
356
+ "min": retJava[i].getMin(),
357
+ "max": retJava[i].getMax()
358
+ }
359
+ )
360
+ end
361
+ return retRb
352
362
  end
353
363
  end
354
364
  end
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.12
4
+ version: 0.0.13
5
5
  platform: java
6
6
  authors:
7
7
  - siranovel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-27 00:00:00.000000000 Z
11
+ date: 2024-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake