Closeness measures

S-measure

Computing the s-statistic

using CausalityTools
x, y = randn(3000), randn(3000)
measure = SMeasure(dx = 3, dy = 3)
s = s_measure(measure, x, y)
0.010339220923855568

The s statistic is larger when there is stronger coupling and smaller when there is weaker coupling. To check whether s is significant (i.e. large enough to claim directional dependence), we can use a SurrogateTest, like here.

H-measure

Computing the h-statistic

using CausalityTools
x, y = randn(3000), randn(3000)
measure = HMeasure(dx = 3, dy = 3)
h = h_measure(measure, x, y)
0.1430250368439299

M-measure

Computing the m-statistic

using CausalityTools
x, y = randn(3000), randn(3000)
measure = MMeasure(dx = 3, dy = 3)
m = m_measure(measure, x, y)
0.0071780504815495885

L-measure

Computing the l-statistic

using CausalityTools
x, y = randn(3000), randn(3000)
measure = LMeasure(dx = 3, dy = 3)
l = l_measure(measure, x, y)
-0.004540255551558583

Joint distance distribution

Computing the Δ-distribution

using CausalityTools
x, y = randn(3000), randn(3000)
measure = JointDistanceDistribution(D = 3, B = 5)
Δ = jdd(measure, x, y)
5-element Vector{Float64}:
  0.00033377822261761343
 -1.3351128904704498e-6
 -2.225188150784083e-6
  1.557631705548831e-6
  1.3351128904704498e-6

The joint distance distribution measure indicates directional coupling between x and y if Δ is skewed towards positive values. We can use a JointDistanceDistributionTest to formally check this.

test = JointDistanceDistributionTest(measure)
independence(test, x, y)
`JointDistanceDistributionTest` independence test
----------------------------------------------------------------------------------
H₀: μ(Δ) = 0 (the input variables are independent)
H₁: μ(Δ) > 0 (there is directional dependence between the input variables)
----------------------------------------------------------------------------------
Hypothetical μ(Δ): 0.0
Observed μ(Δ):     6.662213323447563e-5
p-value:           0.07447015239143417
  α = 0.05:  ✖ Independence cannot be rejected
  α = 0.01:  ✖ Independence cannot be rejected
  α = 0.001: ✖ Independence cannot be rejected

The p-value is fairly low, and depending on the significance level 1 - α, we cannot reject the null hypothesis that Δ is not skewed towards positive values, and hence we cannot reject that the variables are independent.