I need to do the chiSquaredTest. I'm using the Apache Commons Math library but not sure what is a long[][]
what the difference to a long[]
? Here is the method description :
public double chiSquareTest(long[][] counts)
throws NullArgumentException,
DimensionMismatchException,
NotPositiveException,
MaxCountExceededException
Returns the observed significance level, or p-value, associated with a chi-square test of independence based on the input counts array, viewed as a two-way table.
The rows of the 2-way table are count[ 0 ], ... , count[count.length - 1]
Preconditions:
Parameters:
Returns:
long[]
- it is one dimensional array.
long[] array = new long[4];
/* result of that array
{0, 0, 0, 0}
*/
long[][]
- it is array of arrays / two dimensional array.
long[][] array2 = new long[4][];
array2[0] = new long[1];
array2[1] = new long[2];
array2[2] = new long[4];
array2[3] = new long[3];
/* result of that array
{
{0},
{0, 0},
{0, 0, 0, 0},
{0, 0, 0},
}
*/
or it can be like that:
long[][] array = new long[4][4];
/* result of that array
{
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
}
*/
For more examples go to this link.