chi2_approx, x, y)

Fast chi-squared approximation for the p-value.

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

  • 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).


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

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



Cencheng Shen and Joshua T. Vogelstein. The exact equivalence of distance and kernel methods in hypothesis testing. AStA Advances in Statistical Analysis, September 2020. doi:10.1007/s10182-020-00378-1.


Cencheng Shen, Sambit Panda, and Joshua T. Vogelstein. The Chi-Square Test of Distance Correlation. Journal of Computational and Graphical Statistics, 0(ja):1–21, June 2021. doi:10.1080/10618600.2021.1938585.


Sambit Panda, Cencheng Shen, Ronan Perry, Jelle Zorn, Antoine Lutz, Carey E. Priebe, and Joshua T. Vogelstein. Nonpar MANOVA via Independence Testing. arXiv:1910.08883 [cs, stat], April 2021. arXiv:1910.08883.