Skip to content

Joint distance distribution

Distribution of joint distances

# CausalityTools.joint_distance_distributionMethod.

joint_distance_distribution(source, target;
    distance_metric = SqEuclidean(), 
    B::Int = 10, 
    D::Int = 2, τ::Int = 1) -> Vector{Float64}

Compute the joint distance distribution [1] from source to target using the provided distance_metric, with B controlling the number of subintervals, D the embedding dimension and τ the embedding lag.

Example

x, y = rand(1000), rand(1000)

jdd = joint_distance_distribution(x, y)

Keyword arguments

  • distance_metric::Metric: An instance of a valid distance metric from Distances.jl. Defaults to SqEuclidean().
  • B: The number of equidistant subintervals to divide the interval [0, 1] into when comparing the normalised distances.
  • D: Embedding dimension.
  • τ: Embedding delay.

References

[1] Amigó, José M., and Yoshito Hirata. "Detecting directional couplings from multivariate flows by the joint distance distribution." Chaos: An Interdisciplinary Journal of Nonlinear Science 28.7 (2018): 075302.

source

Hypothesis test on the joint distance distribution

For the joint distance distribution to indicate a causal influence, it must be significantly skewed towards positive values.

Providing the OneSampleTTest type as the first argument yields a one sample t-test on the joint distance distribution. From this test, you can extract p-values and obtain confidence intervals like in HypothesisTests.jl as usual.

# CausalityTools.joint_distance_distributionMethod.

joint_distance_distribution(test::OneSampleTTest, source, target, 
    distance_metric = SqEuclidean(), 
    B::Int = 10, 
    D::Int = 2, τ::Int = 1, 
    μ0 = 0.0) -> OneSampleTTest

Perform a one sample t-test to check that the joint distance distribution [1] computed from source to target is biased towards positive values, using the null hypothesis that the mean of the distribution is μ0.

The interpretation of the t-test is that if we can reject the null, then the joint distance distribution is biased towards positive values, and then there exists an underlying coupling from source to target.

Example

x, y = rand(1000), rand(1000)

jdd = joint_distance_distribution(OneSampleTTest, x, y)

which gives

One sample t-test
-----------------
Population details:
    parameter of interest:   Mean
    value under h_0:         0.0
    point estimate:          0.06361857324022721
    95% confidence interval: (0.0185, 0.1087)

Test summary:
    outcome with 95% confidence: reject h_0
    two-sided p-value:           0.0082

Details:
    number of observations:   20
    t-statistic:              2.9517208721082873
    degrees of freedom:       19
    empirical standard error: 0.0215530451545668

The lower bound of the confidence interval for the mean of the joint distance distribution is 0.0185 at confidence level α = 0.05. The meaning that the test falsely detected causality from x to y between these two random time series. To get the confidence intervals at confidence level α, use confinf(jdd, α). If you just want the p-value at 95% confidence, use pvalue(jdd, tail = :left)

Keyword arguments

  • distance_metric::Metric: An instance of a valid distance metric from Distances.jl. Defaults to SqEuclidean().
  • B: The number of equidistant subintervals to divide the interval [0, 1] into when comparing the normalised distances.
  • D: Embedding dimension.
  • τ: Embedding delay.
  • μ0: The hypothetical mean value of the joint distance distribution if there is no coupling between x and y (default is μ0 = 0.0).

References

[1] Amigó, José M., and Yoshito Hirata. "Detecting directional couplings from multivariate flows by the joint distance distribution." Chaos: An Interdisciplinary Journal of Nonlinear Science 28.7 (2018): 075302.

source