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.010407848955297654

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.12810905237231351

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.02056015744486946

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.0039994386909024526

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.00033644844839855433
  1.1793497199155667e-5
  8.010677342822699e-6
 -6.67556445235252e-7
  2.225188150784354e-7

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 μ(Δ):     7.116151706207518e-5
p-value:           0.06376811534851834
  α = 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.