For conducting a Chi-square test on two sets of data distributions, one distribution will be called the observed distribution and the other distribution will be called the expected distribution.
Create a method that takes these two distributions as arguments. Note that the observed distribution is a
long
array, while the expected distribution is adouble
array:public void getChiSquare(long[] observed, double[] expected){
Get the t-statistic of the Chi-square test as follows:
System.out.println(TestUtils.chiSquare(expected, observed));
The p-value of the test can found in a similar way but with a different method:
System.out.println(TestUtils.chiSquareTest(expected, observed));
We can also observe whether the difference between the expected and observed data distributions is significant for a given confidence interval, as follows:
System.out.println(TestUtils.chiSquareTest(expected, observed...