From f85e603756fa69c7afeb079d8e1a40a46ca7312b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Hoskovec?= Date: Mon, 1 Jun 2020 11:16:21 +0200 Subject: [PATCH 1/2] [HSIC] add p_value to results --- HSIC.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HSIC.py b/HSIC.py index 248db4b..7463d1b 100644 --- a/HSIC.py +++ b/HSIC.py @@ -106,5 +106,6 @@ def hsic_gam(X, Y, alph = 0.5): bet = varHSIC*n / mHSIC thresh = gamma.ppf(1-alph, al, scale=bet)[0][0] + p_value = 2*(1-gamma.cdf(testStat, al, scale=bet))[0][0] - return (testStat, thresh) + return (testStat, thresh, p_value) From d7368c0f719a84cc03ab14fd4d618d7ba8a035cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Hoskovec?= Date: Mon, 1 Jun 2020 11:16:39 +0200 Subject: [PATCH 2/2] [README] add p_value to README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f8f0efa..68fa42f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ from HSIC import hsic_gam Apply HSIC on your data ``` -testStat, thresh = hsic_gam(x, y, alph = 0.05) +testStat, thresh, p_value = hsic_gam(x, y, alph = 0.05) ``` ### Description @@ -31,7 +31,7 @@ Input of function `hsic_gam()` |---|---| |x | Data of the first variable. `(n, dim_x)` numpy array.| |y | Data of the second variable. `(n, dim_y)` numpy array.| -|alph | level of the test | +|alph (default=0.05) | level of the test | Output of function `hsic_gam()` @@ -39,6 +39,7 @@ Output of function `hsic_gam()` |---|---| |testStat |test threshold for level alpha test| |thresh| test statistic| +|p_value| p-value of a statistical test with the null hypothesis: x, y are independent ### Independence test result - If **testStat < thresh**, `x` and `y` are independent.