org.apache.commons.math3.stat.inference.TestUtils Java Examples
The following examples show how to use
org.apache.commons.math3.stat.inference.TestUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatsUtil.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
/** * One sample t test * @param a Input data * @param mu Expected value in null hypothesis * @return t_statistic and p_value */ public static double[] tTest(Array a, double mu){ double[] ad = (double[]) ArrayUtil.copyToNDJavaArray_Double(a); double s = TestUtils.t(mu, ad); double p = TestUtils.tTest(mu, ad); return new double[]{s, p}; }
Example #2
Source File: StatsUtil.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
/** * unpaired, two-sided, two-sample t-test. * * @param a Sample a. * @param b Sample b. * @return t_statistic and p_value */ public static double[] tTest(Array a, Array b) { double[] ad = (double[]) ArrayUtil.copyToNDJavaArray_Double(a); double[] bd = (double[]) ArrayUtil.copyToNDJavaArray_Double(b); double s = TestUtils.t(ad, bd); double p = TestUtils.tTest(ad, bd); return new double[]{s, p}; }
Example #3
Source File: StatsUtil.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
/** * Chi-square test * * @param e Expected. * @param o Observed. * @return Chi-square_statistic and p_value */ public static double[] chiSquareTest(Array e, Array o) { double[] ed = (double[]) ArrayUtil.copyToNDJavaArray_Double(e); long[] od = (long[]) ArrayUtil.copyToNDJavaArray_Long(o); double s = TestUtils.chiSquare(ed, od); double p = TestUtils.chiSquareTest(ed, od); return new double[]{s, p}; }
Example #4
Source File: StatsUtil.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
/** * Chi-square test of independence * * @param o Observed. * @return Chi-square_statistic and p_value */ public static double[] chiSquareTest(Array o) { long[][] od = (long[][]) ArrayUtil.copyToNDJavaArray_Long(o); double s = TestUtils.chiSquare(od); double p = TestUtils.chiSquareTest(od); return new double[]{s, p}; }
Example #5
Source File: AnovaTest.java From Java-Data-Science-Cookbook with MIT License | 5 votes |
public void calculateAnova(double[] calorie, double[] fat, double[] carb, double[] control){ List<double[]> classes = new ArrayList<double[]>(); classes.add(calorie); classes.add(fat); classes.add(carb); classes.add(control); System.out.println(TestUtils.oneWayAnovaFValue(classes)); // F-value System.out.println(TestUtils.oneWayAnovaPValue(classes)); // P-value System.out.println(TestUtils.oneWayAnovaTest(classes, 0.05)); }
Example #6
Source File: OwlSimPValue.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
public PValue getPValue(Set<OWLClass> candidates, IRI referenceEntity) throws OwlSimVarianceEntityReferenceNotFoundException { if (!refBasedStats.getReferenceStats().containsKey(referenceEntity)) { throw new OwlSimVarianceEntityReferenceNotFoundException(referenceEntity); } // Create IC list for candidates provided double[] icData = refBasedStats.retrieveCandidatesIC(candidates); List<double[]> sets = new ArrayList<double[]>(); sets.add(icData); sets.add(refBasedStats.getReferenceStats().get(referenceEntity).getValues()); return new PValue(TestUtils.tTest(refBasedStats.getReferenceStats().get(referenceEntity).getMean(), icData), TestUtils.oneWayAnovaPValue(sets), TestUtils.kolmogorovSmirnovStatistic(icData, refBasedStats.getReferenceStats().get(referenceEntity).getValues())); }
Example #7
Source File: KSTest.java From Java-Data-Science-Cookbook with MIT License | 4 votes |
public void calculateKs(double[] x, double[] y){ double d = TestUtils.kolmogorovSmirnovStatistic(x, y); System.out.println(TestUtils.kolmogorovSmirnovTest(x, y, false)); System.out.println(TestUtils.exactP(d, x.length, y.length, false)); }
Example #8
Source File: ChiSquareTest.java From Java-Data-Science-Cookbook with MIT License | 4 votes |
public void getChiSquare(long[] observed, double[] expected){ System.out.println(TestUtils.chiSquare(expected, observed));//t statistics System.out.println(TestUtils.chiSquareTest(expected, observed));//p value System.out.println(TestUtils.chiSquareTest(expected, observed, 0.05)); }
Example #9
Source File: TTest.java From Java-Data-Science-Cookbook with MIT License | 4 votes |
public void getTtest(double[] sample1, double[] sample2){ System.out.println(TestUtils.pairedT(sample1, sample2));//t statistics System.out.println(TestUtils.pairedTTest(sample1, sample2));//p value System.out.println(TestUtils.pairedTTest(sample1, sample2, 0.05)); }
Example #10
Source File: BenchmarkUtils.java From aws-sdk-java-v2 with Apache License 2.0 | 4 votes |
private static boolean isDifferent(SdkBenchmarkStatistics current, SdkBenchmarkStatistics other, double confidence) { return TestUtils.tTest(current, other, 1 - confidence); }
Example #11
Source File: ColumnCounter.java From HMMRATAC with GNU General Public License v3.0 | 4 votes |
private static double getonesidedPValue(double mu,double[] sample1){ double PValue = TestUtils.tTest(mu, sample1); return PValue; }
Example #12
Source File: SignificanceTester.java From HMMRATAC with GNU General Public License v3.0 | 4 votes |
private static double getonesidedPValue(double mu,double[] sample1){ double PValue = TestUtils.tTest(mu, sample1); return PValue; }
Example #13
Source File: StatsUtil.java From MeteoInfo with GNU Lesser General Public License v3.0 | 3 votes |
/** * Paired test evaluating the null hypothesis that the mean difference * between corresponding (paired) elements of the double[] arrays sample1 * and sample2 is zero. * * @param a Sample a. * @param b Sample b. * @return t_statistic and p_value */ public static double[] pairedTTest(Array a, Array b) { double[] ad = (double[]) ArrayUtil.copyToNDJavaArray_Double(a); double[] bd = (double[]) ArrayUtil.copyToNDJavaArray_Double(b); double s = TestUtils.pairedT(ad, bd); double p = TestUtils.pairedTTest(ad, bd); return new double[]{s, p}; }
Example #14
Source File: ColumnCounter.java From HMMRATAC with GNU General Public License v3.0 | 3 votes |
private static double gettwosidedPValue(double[] sample1,double[] sample2){ double PValue = TestUtils.tTest(sample1, sample2); return PValue; }
Example #15
Source File: SignificanceTester.java From HMMRATAC with GNU General Public License v3.0 | 3 votes |
private static double gettwosidedPValue(double[] sample1,double[] sample2){ double PValue = TestUtils.tTest(sample1, sample2); return PValue; }