chi2_approx

hyppo.tools.chi2_approx(calc_stat, x, y)

Fast chi-squared approximation for the p-value.

In the case of distance and kernel methods, Dcorr (and by extension Hsic [2]) can be approximated via a chi-squared distribution [1]. This approximation is also applicable for the nonparametric MANOVA via independence testing method in our package [3].

Parameters
  • calc_stat (callable) -- The method used to calculate the test statistic (must use hyppo API).

  • x,y (ndarray) -- Input data matrices. x and y must have the same number of samples. That is, the shapes must be (n, p) and (n, q) where n is the number of samples and p and q are the number of dimensions. Alternatively, x and y can be distance or similarity matrices, where the shapes must both be (n, n).

Returns

  • stat (float) -- The computed test statistic.

  • pvalue (float) -- The computed p-value.