1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
22
23
24
25
26
27
28 public class TestUtils {
29
30
31
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
44
45
46
47
48 public static TTest getTTest() {
49 return tTest;
50 }
51
52
53
54
55
56
57 public static ChiSquareTest getChiSquareTest() {
58 return chiSquareTest;
59 }
60
61
62
63
64 public static double homoscedasticT(double[] sample1, double[] sample2)
65 throws IllegalArgumentException {
66 return tTest.homoscedasticT(sample1, sample2);
67 }
68
69
70
71
72 public static double homoscedasticT(StatisticalSummary sampleStats1,
73 StatisticalSummary sampleStats2)
74 throws IllegalArgumentException {
75 return tTest.homoscedasticT(sampleStats1, sampleStats2);
76 }
77
78
79
80
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
88
89
90 public static double homoscedasticTTest(double[] sample1, double[] sample2)
91 throws IllegalArgumentException, MathException {
92 return tTest.homoscedasticTTest(sample1, sample2);
93 }
94
95
96
97
98 public static double homoscedasticTTest(StatisticalSummary sampleStats1,
99 StatisticalSummary sampleStats2)
100 throws IllegalArgumentException, MathException {
101 return tTest.homoscedasticTTest(sampleStats1, sampleStats2);
102 }
103
104
105
106
107 public static double pairedT(double[] sample1, double[] sample2)
108 throws IllegalArgumentException, MathException {
109 return tTest.pairedT(sample1, sample2);
110 }
111
112
113
114
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
122
123
124 public static double pairedTTest(double[] sample1, double[] sample2)
125 throws IllegalArgumentException, MathException {
126 return tTest.pairedTTest(sample1, sample2);
127 }
128
129
130
131
132 public static double t(double mu, double[] observed)
133 throws IllegalArgumentException {
134 return tTest.t(mu, observed);
135 }
136
137
138
139
140 public static double t(double mu, StatisticalSummary sampleStats)
141 throws IllegalArgumentException {
142 return tTest.t(mu, sampleStats);
143 }
144
145
146
147
148 public static double t(double[] sample1, double[] sample2)
149 throws IllegalArgumentException {
150 return tTest.t(sample1, sample2);
151 }
152
153
154
155
156 public static double t(StatisticalSummary sampleStats1,
157 StatisticalSummary sampleStats2)
158 throws IllegalArgumentException {
159 return tTest.t(sampleStats1, sampleStats2);
160 }
161
162
163
164
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
171
172
173 public static double tTest(double mu, double[] sample)
174 throws IllegalArgumentException, MathException {
175 return tTest.tTest(mu, sample);
176 }
177
178
179
180
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
188
189
190 public static double tTest(double mu, StatisticalSummary sampleStats)
191 throws IllegalArgumentException, MathException {
192 return tTest.tTest(mu, sampleStats);
193 }
194
195
196
197
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
204
205
206 public static double tTest(double[] sample1, double[] sample2)
207 throws IllegalArgumentException, MathException {
208 return tTest.tTest(sample1, sample2);
209 }
210
211
212
213
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
221
222
223 public static double tTest(StatisticalSummary sampleStats1,
224 StatisticalSummary sampleStats2)
225 throws IllegalArgumentException, MathException {
226 return tTest.tTest(sampleStats1, sampleStats2);
227 }
228
229
230
231
232 public static double chiSquare(double[] expected, long[] observed)
233 throws IllegalArgumentException {
234 return chiSquareTest.chiSquare(expected, observed);
235 }
236
237
238
239
240 public static double chiSquare(long[][] counts)
241 throws IllegalArgumentException {
242 return chiSquareTest.chiSquare(counts);
243 }
244
245
246
247
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
255
256
257 public static double chiSquareTest(double[] expected, long[] observed)
258 throws IllegalArgumentException, MathException {
259 return chiSquareTest.chiSquareTest(expected, observed);
260 }
261
262
263
264
265 public static boolean chiSquareTest(long[][] counts, double alpha)
266 throws IllegalArgumentException, MathException {
267 return chiSquareTest. chiSquareTest(counts, alpha);
268 }
269
270
271
272
273 public static double chiSquareTest(long[][] counts)
274 throws IllegalArgumentException, MathException {
275 return chiSquareTest. chiSquareTest(counts);
276 }
277
278 }