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 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.
- Parameters
calc_stat (
callable
) -- The method used to calculate the test statistic (must use hyppo API).x,y (
ndarray
offloat
) -- Input data matrices.x
andy
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
andy
can be distance or similarity matrices, where the shapes must both be(n, n)
.
- Returns
References
- 1
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.
- 2
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.
- 3
Sambit Panda, Cencheng Shen, Ronan Perry, Jelle Zorn, Antoine Lutz, Carey E. Priebe, and Joshua T. Vogelstein. Universally consistent K-sample tests via dependence measures. Statistics & Probability Letters, 216:110278, January 2025. doi:10.1016/j.spl.2024.110278.