1dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond/*
2dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * Licensed to the Apache Software Foundation (ASF) under one or more
3dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * contributor license agreements.  See the NOTICE file distributed with
4dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * this work for additional information regarding copyright ownership.
5dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * The ASF licenses this file to You under the Apache License, Version 2.0
6dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * (the "License"); you may not use this file except in compliance with
7dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * the License.  You may obtain a copy of the License at
8dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *
9dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *      http://www.apache.org/licenses/LICENSE-2.0
10dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond *
11dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * Unless required by applicable law or agreed to in writing, software
12dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * distributed under the License is distributed on an "AS IS" BASIS,
13dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * See the License for the specific language governing permissions and
15dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * limitations under the License.
16dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond */
17dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondpackage org.apache.commons.math.stat.inference;
18dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
19dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondimport org.apache.commons.math.MathException;
20dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
21dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond/**
22dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * An interface for Chi-Square tests.
23dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * <p>This interface handles only known distributions. If the distribution is
24dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * unknown and should be provided by a sample, then the {@link UnknownDistributionChiSquareTest
25dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * UnknownDistributionChiSquareTest} extended interface should be used instead.</p>
26dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond * @version $Revision: 811685 $ $Date: 2009-09-05 19:36:48 +0200 (sam. 05 sept. 2009) $
27dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond */
28dee0849a9704d532af0b550146cbafbaa6ee1d19Raymondpublic interface ChiSquareTest {
29dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
30dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     /**
31dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Computes the <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm">
32dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Chi-Square statistic</a> comparing <code>observed</code> and <code>expected</code>
33dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * frequency counts.
34dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
35dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * This statistic can be used to perform a Chi-Square test evaluating the null hypothesis that
36dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  the observed counts follow the expected distribution.</p>
37dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
38dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Preconditions</strong>: <ul>
39dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>Expected counts must all be positive.
40dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
41dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>Observed counts must all be >= 0.
42dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
43dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The observed and expected arrays must have the same length and
44dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * their common length must be at least 2.
45dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li></ul></p><p>
46dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * If any of the preconditions are not met, an
47dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>IllegalArgumentException</code> is thrown.</p>
48dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *
49dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param observed array of observed frequency counts
50dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param expected array of expected frequency counts
51dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return chiSquare statistic
52dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws IllegalArgumentException if preconditions are not met
53dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
54dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    double chiSquare(double[] expected, long[] observed)
55dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond        throws IllegalArgumentException;
56dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
57dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
58dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Returns the <i>observed significance level</i>, or <a href=
59dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * "http://www.cas.lancs.ac.uk/glossary_v1.1/hyptest.html#pvalue">
60dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * p-value</a>, associated with a
61dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm">
62dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Chi-square goodness of fit test</a> comparing the <code>observed</code>
63dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * frequency counts to those in the <code>expected</code> array.
64dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
65dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * The number returned is the smallest significance level at which one can reject
66dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * the null hypothesis that the observed counts conform to the frequency distribution
67dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * described by the expected counts.</p>
68dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
69dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Preconditions</strong>: <ul>
70dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>Expected counts must all be positive.
71dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
72dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>Observed counts must all be >= 0.
73dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
74dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The observed and expected arrays must have the same length and
75dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * their common length must be at least 2.
76dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li></ul></p><p>
77dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * If any of the preconditions are not met, an
78dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>IllegalArgumentException</code> is thrown.</p>
79dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *
80dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param observed array of observed frequency counts
81dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param expected array of expected frequency counts
82dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return p-value
83dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws IllegalArgumentException if preconditions are not met
84dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws MathException if an error occurs computing the p-value
85dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
86dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    double chiSquareTest(double[] expected, long[] observed)
87dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond        throws IllegalArgumentException, MathException;
88dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
89dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
90dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Performs a <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm">
91dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Chi-square goodness of fit test</a> evaluating the null hypothesis that the observed counts
92dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * conform to the frequency distribution described by the expected counts, with
93dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * significance level <code>alpha</code>.  Returns true iff the null hypothesis can be rejected
94dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * with 100 * (1 - alpha) percent confidence.
95dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
96dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Example:</strong><br>
97dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * To test the hypothesis that <code>observed</code> follows
98dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>expected</code> at the 99% level, use </p><p>
99dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>chiSquareTest(expected, observed, 0.01) </code></p>
100dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
101dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Preconditions</strong>: <ul>
102dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>Expected counts must all be positive.
103dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
104dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>Observed counts must all be >= 0.
105dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
106dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The observed and expected arrays must have the same length and
107dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * their common length must be at least 2.
108dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li> <code> 0 < alpha < 0.5 </code>
109dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li></ul></p><p>
110dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * If any of the preconditions are not met, an
111dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>IllegalArgumentException</code> is thrown.</p>
112dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *
113dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param observed array of observed frequency counts
114dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param expected array of expected frequency counts
115dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param alpha significance level of the test
116dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return true iff null hypothesis can be rejected with confidence
117dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * 1 - alpha
118dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws IllegalArgumentException if preconditions are not met
119dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws MathException if an error occurs performing the test
120dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
121dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    boolean chiSquareTest(double[] expected, long[] observed, double alpha)
122dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond        throws IllegalArgumentException, MathException;
123dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
124dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
125dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  Computes the Chi-Square statistic associated with a
126dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <a href="http://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm">
127dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  chi-square test of independence</a> based on the input <code>counts</code>
128dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  array, viewed as a two-way table.
129dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
130dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * The rows of the 2-way table are
131dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>count[0], ... , count[count.length - 1] </code></p>
132dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
133dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Preconditions</strong>: <ul>
134dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>All counts must be >= 0.
135dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
136dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The count array must be rectangular (i.e. all count[i] subarrays
137dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  must have the same length).
138dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
139dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The 2-way table represented by <code>counts</code> must have at
140dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  least 2 columns and at least 2 rows.
141dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
142dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li></ul></p><p>
143dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * If any of the preconditions are not met, an
144dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>IllegalArgumentException</code> is thrown.</p>
145dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *
146dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param counts array representation of 2-way table
147dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return chiSquare statistic
148dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws IllegalArgumentException if preconditions are not met
149dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
150dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    double chiSquare(long[][] counts)
151dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    throws IllegalArgumentException;
152dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
153dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
154dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Returns the <i>observed significance level</i>, or <a href=
155dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * "http://www.cas.lancs.ac.uk/glossary_v1.1/hyptest.html#pvalue">
156dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * p-value</a>, associated with a
157dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <a href="http://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm">
158dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * chi-square test of independence</a> based on the input <code>counts</code>
159dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * array, viewed as a two-way table.
160dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
161dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * The rows of the 2-way table are
162dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>count[0], ... , count[count.length - 1] </code></p>
163dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
164dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Preconditions</strong>: <ul>
165dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>All counts must be >= 0.
166dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
167dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The count array must be rectangular (i.e. all count[i] subarrays must have the same length).
168dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
169dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The 2-way table represented by <code>counts</code> must have at least 2 columns and
170dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *        at least 2 rows.
171dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
172dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li></ul></p><p>
173dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * If any of the preconditions are not met, an
174dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>IllegalArgumentException</code> is thrown.</p>
175dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *
176dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param counts array representation of 2-way table
177dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return p-value
178dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws IllegalArgumentException if preconditions are not met
179dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws MathException if an error occurs computing the p-value
180dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
181dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    double chiSquareTest(long[][] counts)
182dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    throws IllegalArgumentException, MathException;
183dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
184dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    /**
185dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * Performs a <a href="http://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm">
186dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * chi-square test of independence</a> evaluating the null hypothesis that the classifications
187dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * represented by the counts in the columns of the input 2-way table are independent of the rows,
188dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * with significance level <code>alpha</code>.  Returns true iff the null hypothesis can be rejected
189dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * with 100 * (1 - alpha) percent confidence.
190dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
191dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * The rows of the 2-way table are
192dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>count[0], ... , count[count.length - 1] </code></p>
193dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
194dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Example:</strong><br>
195dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * To test the null hypothesis that the counts in
196dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>count[0], ... , count[count.length - 1] </code>
197dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *  all correspond to the same underlying probability distribution at the 99% level, use </p><p>
198dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>chiSquareTest(counts, 0.01) </code></p>
199dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <p>
200dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <strong>Preconditions</strong>: <ul>
201dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>All counts must be >= 0.
202dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
203dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The count array must be rectangular (i.e. all count[i] subarrays must have the same length).
204dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
205dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <li>The 2-way table represented by <code>counts</code> must have at least 2 columns and
206dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *        at least 2 rows.
207dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li>
208dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * </li></ul></p><p>
209dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * If any of the preconditions are not met, an
210dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * <code>IllegalArgumentException</code> is thrown.</p>
211dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     *
212dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param counts array representation of 2-way table
213dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @param alpha significance level of the test
214dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @return true iff null hypothesis can be rejected with confidence
215dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * 1 - alpha
216dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws IllegalArgumentException if preconditions are not met
217dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     * @throws MathException if an error occurs performing the test
218dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond     */
219dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    boolean chiSquareTest(long[][] counts, double alpha)
220dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond    throws IllegalArgumentException, MathException;
221dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond
222dee0849a9704d532af0b550146cbafbaa6ee1d19Raymond}
223