Skip to content

S-measure

# CausalityTools.CausalityTests.SMeasureTestType.

SMeasureTest(m, τ, K)
SMeasureTest(m::Int, τ, K; metric::Metric = SqEuclidean(), 
    tree_metric::Metric = Euclidean())

S-measure test [1] for the directional dependence between data series.

Algorithm

  1. Create an m-dimensional embeddings of both x and y, resulting in N different m-dimensional embedding points X = \{x_1, x_2, \ldots, x_N \} and X = \{y_1, y_2, \ldots, y_N \}. τ controls the embedding lag.
  2. Let r_{i,j} and s_{i,j} be the indices of the k-th nearest neighbors of x_i and y_i, respectively.
  3. Compute the the mean squared Euclidean distance to the k nearest neighbors for each x_i, using the indices r_{i, j}.
R_i^{(k)}(x) = \dfrac{1}{k} \sum_{i=1}^{k}(x_i, x_{r_{i,j}})^2
  • Compute the y-conditioned mean squared Euclidean distance to the k nearest neighbors for each x_i, now using the indices s_{i,j}.
R_i^{(k)}(x|y) = \dfrac{1}{k} \sum_{i=1}^{k}(x_i, x_{s_{i,j}})^2
  • Define the following measure of independence, where 0 \leq S \leq 1, and low values indicate independence and values close to one occur for synchronized signals.
S^{(k)}(x|y) = \dfrac{1}{N} \sum_{i=1}^{N} \dfrac{R_i^{(k)}(x)}{R_i^{(k)}(x|y)}

Examples

# Initialise test, specifying embedding dimension, embedding lag 
# and number of nearest neighbors
test = SMeasureTest(m = 4, τ = 3, K = 2:10)

References

  1. Quian Quiroga, R., Arnhold, J. & Grassberger, P. [2000] “Learning driver-response relationships from synchronization patterns,” Phys. Rev. E61(5), 5142–5148.

source

Tutorials