chiSquareTest#

swordfish.function.chiSquareTest()#

If X is a vector, conduct a Chi-squared goodness of fit test whether X and Y follow the same distribution. If X is a matrix/table, conduct Pearson’s Chi-squared test on X.

Parameters:

X (Constant) – A numeric vector/matrix/table. If X is a vector, Y is a numeric vector of the same length as X. Y is not required if X is not a vector.

Returns:

A dictionary with the following keys:

  • pValue: p-value of the test

  • df: degree of freedom

  • chiSquaredValue: Chi-squared test statistic

  • method: either “Chi-square goodness of fit test” or “Pearson’s Chi-squared test”

Return type:

Constant