EchoTime Explainable time-series similarity for humans and agents.
Examples / Beginner example
Beginner example

US Treasury 10Y and 2Y yields in 2024

A first real-data example: read two columns from a CSV snapshot, compare them, and inspect how stable the relationship stays across the year.

Question

How tightly did the 10Y and 2Y Treasury yield curves move together across 2024?

This page uses a frozen FRED snapshot of the 2024 daily 10Y and 2Y Treasury yields. The workflow is intentionally plain: read the CSV, call compare_series(...), then add rolling_similarity(...) when you want to see whether the relationship drifts.

Input two numeric columns from one CSV Call compare_series(df['dgs10'], df['dgs2']) Output SimilarityReport + rolling windows
  1. Read the local CSV snapshot with pandas.
  2. Select the two yield columns you want to compare.
  3. Run compare_series(...) first, then rolling_similarity(...) if you want time-local context.
Result at a glance
Pearson 0.82Spearman 0.77Mutual info 0.45Diff r 0.81
Component mean 0.77 across 5 time-series metrics

10Y Treasury vs 2Y Treasury: Pearson r 0.82, Spearman rho 0.77, Kendall tau 0.63. The best agreement appears in trend similarity and shape similarity.

trend similarity0.87
shape similarity0.82
derivative similarity0.81
spectral similarity0.75
Runnable example

This is the minimal script a human user would actually run: load data, call EchoTime, inspect the returned object.

from pathlib import Path

import pandas as pd
from echotime import compare_series, rolling_similarity


data_path = Path(__file__).resolve().parents[1] / "data" / "real_treasury_yields_2024.csv"
df = pd.read_csv(data_path)

report = compare_series(df["dgs10"], df["dgs2"], left_name="10Y Treasury", right_name="2Y Treasury")
windows = rolling_similarity(df["dgs10"], df["dgs2"], window=30, step=10)

print(report.to_summary_card_markdown())
print({"rolling_windows": len(windows), "mean_similarity": round(report.similarity_score, 3)})
What you should see

You should get a very high but not perfect match because the two rates move together strongly without collapsing into the same curve.

# EchoTime similarity summary

**Compared:** 10Y Treasury vs 2Y Treasury

## Headline

10Y Treasury vs 2Y Treasury: Pearson r 0.82, Spearman rho 0.77, Kendall tau 0.63. The best agreement appears in trend similarity and shape similarity.

## Familiar statistics

| metric | value |
|---|---:|
| Pearson r | 0.824 |
| Spearman rho | 0.765 |
| Kendall tau | 0.627 |
| Best-lag Pearson r | 0.825 |
| Mutual info | 0.446 |
| First-difference r | 0.812 |

## Time-series-specific metrics

| plain-language label | score |
|---|---:|
| trend similarity | 0.871 |
| shape similarity | 0.818 |
| derivative similarity | 0.812 |
| spectral similarity | 0.746 |

## Recommended next actions

- Plot both series after z-score normalization to show the shared shape without scale differences.
- Run rolling or windowed similarity if you expect the relationship to change over time.
- Use structural-profile similarity when scales, frequencies, or observation modes differ too much for raw-shape comparison.
- Inspect spectral or seasonality-aware models because the two series share rhythm strongly.
  • Pearson 0.82 / Spearman 0.77 / Mutual info 0.45 says the two Treasury curves move together strongly at the level and rank level.
  • Trend and spectral agreement stay high, which is what you would expect from two rates embedded in the same macro regime.
  • Rolling similarity stays elevated through most of the year instead of collapsing after one short window.
Use your own data

This is the simplest way to use EchoTime on your own two-column CSV.

  • Swap df['dgs10'] and df['dgs2'] for the two numeric columns you care about.
  • If your file has timestamps, keep them in the DataFrame even if the first compare_series(...) call does not require them.
  • Write report.to_html_report() to disk when you need something you can hand to a teammate.
Series overlay
EchoTime series previewSeries preview10Y2Y

The overlay is generated from the real 2024 Treasury yield curves after EchoTime normalizes scale.

Similarity radar
Similarity radarSimilarity radarRadar over the time-series metrics. Read it together with Pearson, Spearman, and mutual info.ShapeDTWTrendDerivativeSpectral

The radar shows which time-series-specific metrics stay high instead of hiding everything inside one opaque number.

Rolling component mean
Rolling component meanRolling component meanmean=0.81, min=0.67, max=0.90 across per-window metric means

Rolling windows show where the average across the similarity metrics stays tight and where it loosens.