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.
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.
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)})
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.
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.
The overlay is generated from the real 2024 Treasury yield curves after EchoTime normalizes scale.
The radar shows which time-series-specific metrics stay high instead of hiding everything inside one opaque number.
Rolling windows show where the average across the similarity metrics stays tight and where it loosens.