Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 2.03 KB

Formulae.md

File metadata and controls

80 lines (57 loc) · 2.03 KB

TRACES (Time-series Relationship Analysis with Comprehensive Evaluation Suite)


Core Analytical Formulae

1. Pearson Correlation Coefficient ($r$)

$$ r = \frac{\sum_{i=1}^n \left(X_i - \bar{X}\right)\left(Y_i - \bar{Y}\right)}{\sqrt{\sum_{i=1}^n \left(X_i - \bar{X}\right)^2} \sqrt{\sum_{i=1}^n \left(Y_i - \bar{Y}\right)^2}} $$

Where:

  • $X_i$ and $Y_i$ are individual sample points
  • $\bar{X}$ and $\bar{Y}$ are the means of the $X$ and $Y$ samples
  • $n$ is the number of paired samples

2. Spearman's Rank Correlation Coefficient ($\rho$)

$$ \rho = 1 - \frac{6 \sum_{i=1}^n d_i^2}{n\left(n^2 - 1\right)} $$

Where:

  • $d_i = rank(X_i) - rank(Y_i)$ is the difference between ranks
  • $n$ is the number of observations

3. Kendall's Tau ($\tau$)

$$ \tau = \frac{C - D}{\sqrt{(C + D + X)(C + D + Y)}} $$

Where:

  • $C$ is the number of concordant pairs
  • $D$ is the number of discordant pairs
  • $X$ is the number of pairs tied only in $X$
  • $Y$ is the number of pairs tied only in $Y$

4. Cross-Correlation Function (CCF)

$$ \text{CCF}(k) = \frac{\sum_{i=1}^{n - k} \left(X_i - \bar{X}\right)\left(Y_{i + k} - \bar{Y}\right)}{\sqrt{\sum_{i=1}^n \left(X_i - \bar{X}\right)^2} \sqrt{\sum_{i=1}^n \left(Y_i - \bar{Y}\right)^2}} $$

Where:

  • $k$ is the lag (shift between series)
  • $n$ is the series length
  • $\text{CCF}(k)$ is cross-correlation at lag $k$

5. Rolling Window Correlation ($r_w$)

$$ r_w(t) = r\left(X_{[t-w+1:t]}, Y_{[t-w+1:t]}\right) $$

Where:

  • $w$ is the window size
  • $t$ is the current time point
  • $[t-w+1:t]$ represents the window interval

6. Relationship Confidence Score ($C_s$)

$$ C_s = \frac{S_c}{3} \cdot \max(|r|, |\rho|, |\tau|) $$

Where:

  • $S_c$ is the count of significant correlations
  • $r$, $\rho$, $\tau$ are Pearson, Spearman, and Kendall coefficients

7. Lag Impact Ratio ($L_r$)

$$ L_r = \left|\frac{\max_{k}(\text{CCF}(k))}{\text{CCF}(0)}\right| $$

Where:

  • $\text{CCF}(k)$ is cross-correlation at lag $k$
  • $\text{CCF}(0)$ is zero-lag correlation