1 16 package org.apache.commons.math.stat.inference; 17 18 import org.apache.commons.math.MathException; 19 import org.apache.commons.math.stat.descriptive.StatisticalSummary; 20 21 28 public class TestUtils { 29 32 protected TestUtils() { 33 super(); 34 } 35 36 37 private static TTest tTest = TestFactory.newInstance().createTTest(); 38 39 40 private static ChiSquareTest chiSquareTest = 41 TestFactory.newInstance().createChiSquareTest(); 42 43 48 public static TTest getTTest() { 49 return tTest; 50 } 51 52 57 public static ChiSquareTest getChiSquareTest() { 58 return chiSquareTest; 59 } 60 61 64 public static double homoscedasticT(double[] sample1, double[] sample2) 65 throws IllegalArgumentException { 66 return tTest.homoscedasticT(sample1, sample2); 67 } 68 69 72 public static double homoscedasticT(StatisticalSummary sampleStats1, 73 StatisticalSummary sampleStats2) 74 throws IllegalArgumentException { 75 return tTest.homoscedasticT(sampleStats1, sampleStats2); 76 } 77 78 81 public static boolean homoscedasticTTest(double[] sample1, double[] sample2, 82 double alpha) 83 throws IllegalArgumentException , MathException { 84 return tTest. homoscedasticTTest(sample1, sample2, alpha); 85 } 86 87 90 public static double homoscedasticTTest(double[] sample1, double[] sample2) 91 throws IllegalArgumentException , MathException { 92 return tTest.homoscedasticTTest(sample1, sample2); 93 } 94 95 98 public static double homoscedasticTTest(StatisticalSummary sampleStats1, 99 StatisticalSummary sampleStats2) 100 throws IllegalArgumentException , MathException { 101 return tTest.homoscedasticTTest(sampleStats1, sampleStats2); 102 } 103 104 107 public static double pairedT(double[] sample1, double[] sample2) 108 throws IllegalArgumentException , MathException { 109 return tTest.pairedT(sample1, sample2); 110 } 111 112 115 public static boolean pairedTTest(double[] sample1, double[] sample2, 116 double alpha) 117 throws IllegalArgumentException , MathException { 118 return tTest.pairedTTest(sample1, sample2, alpha); 119 } 120 121 124 public static double pairedTTest(double[] sample1, double[] sample2) 125 throws IllegalArgumentException , MathException { 126 return tTest.pairedTTest(sample1, sample2); 127 } 128 129 132 public static double t(double mu, double[] observed) 133 throws IllegalArgumentException { 134 return tTest.t(mu, observed); 135 } 136 137 140 public static double t(double mu, StatisticalSummary sampleStats) 141 throws IllegalArgumentException { 142 return tTest.t(mu, sampleStats); 143 } 144 145 148 public static double t(double[] sample1, double[] sample2) 149 throws IllegalArgumentException { 150 return tTest.t(sample1, sample2); 151 } 152 153 156 public static double t(StatisticalSummary sampleStats1, 157 StatisticalSummary sampleStats2) 158 throws IllegalArgumentException { 159 return tTest.t(sampleStats1, sampleStats2); 160 } 161 162 165 public static boolean tTest(double mu, double[] sample, double alpha) 166 throws IllegalArgumentException , MathException { 167 return tTest.tTest(mu, sample, alpha); 168 } 169 170 173 public static double tTest(double mu, double[] sample) 174 throws IllegalArgumentException , MathException { 175 return tTest.tTest(mu, sample); 176 } 177 178 181 public static boolean tTest(double mu, StatisticalSummary sampleStats, 182 double alpha) 183 throws IllegalArgumentException , MathException { 184 return tTest. tTest(mu, sampleStats, alpha); 185 } 186 187 190 public static double tTest(double mu, StatisticalSummary sampleStats) 191 throws IllegalArgumentException , MathException { 192 return tTest.tTest(mu, sampleStats); 193 } 194 195 198 public static boolean tTest(double[] sample1, double[] sample2, double alpha) 199 throws IllegalArgumentException , MathException { 200 return tTest.tTest(sample1, sample2, alpha); 201 } 202 203 206 public static double tTest(double[] sample1, double[] sample2) 207 throws IllegalArgumentException , MathException { 208 return tTest.tTest(sample1, sample2); 209 } 210 211 214 public static boolean tTest(StatisticalSummary sampleStats1, 215 StatisticalSummary sampleStats2, double alpha) 216 throws IllegalArgumentException , MathException { 217 return tTest. tTest(sampleStats1, sampleStats2, alpha); 218 } 219 220 223 public static double tTest(StatisticalSummary sampleStats1, 224 StatisticalSummary sampleStats2) 225 throws IllegalArgumentException , MathException { 226 return tTest.tTest(sampleStats1, sampleStats2); 227 } 228 229 232 public static double chiSquare(double[] expected, long[] observed) 233 throws IllegalArgumentException { 234 return chiSquareTest.chiSquare(expected, observed); 235 } 236 237 240 public static double chiSquare(long[][] counts) 241 throws IllegalArgumentException { 242 return chiSquareTest.chiSquare(counts); 243 } 244 245 248 public static boolean chiSquareTest(double[] expected, long[] observed, 249 double alpha) 250 throws IllegalArgumentException , MathException { 251 return chiSquareTest.chiSquareTest(expected, observed, alpha); 252 } 253 254 257 public static double chiSquareTest(double[] expected, long[] observed) 258 throws IllegalArgumentException , MathException { 259 return chiSquareTest.chiSquareTest(expected, observed); 260 } 261 262 265 public static boolean chiSquareTest(long[][] counts, double alpha) 266 throws IllegalArgumentException , MathException { 267 return chiSquareTest. chiSquareTest(counts, alpha); 268 } 269 270 273 public static double chiSquareTest(long[][] counts) 274 throws IllegalArgumentException , MathException { 275 return chiSquareTest. chiSquareTest(counts); 276 } 277 278 } 279 | Popular Tags |