Yield Curve Intelligence Platform
Multi-method interpolation, leave-one-out validation, PCA factor analysis, and anomaly detection on the U.S. Treasury yield curve. Educational/research use only -- see the Responsible Use tab.
Latest available Treasury yield curve
Observation date: 2026-09-22 (Live data from Treasury.gov.)
Available maturities: 1 Mo = 3.97%, 1.5 Month = 4.04%, 2 Mo = 4.09%, 3 Mo = 4.16%, 4 Mo = 4.26%, 6 Mo = 4.26%, 1 Yr = 4.43%, 2 Yr = 4.71%, 3 Yr = 4.81%, 5 Yr = 4.83%, 7 Yr = 4.89%, 10 Yr = 4.96%, 20 Yr = 5.33%, 30 Yr = 5.29%
Curve classification: Normal
Rule: Normal if both the 10Y-2Y and 10Y-3M spreads exceed +0.10 percentage points; Inverted if both are below -0.10; Flat if both are within +/-0.10 of zero; Mixed if the two spreads disagree.
Key spreads: 10Y-2Y = +0.25 pp, 10Y-3M = +0.80 pp
Select an observation date and target maturity to compare all four methods.
The Lagrange formula
$$P(x) = \sum_{j=0}^{n} y_j \, L_j(x), \qquad L_j(x) = \prod_{k \ne j} \frac{x - x_k}{x_j - x_k}$$
The "switch" idea: each basis polynomial $L_j(x)$ equals 1 at its own node and 0 at
every other node -- like a switch that's "on" only for its own point. Summing $y_j L_j(x)$ over
all nodes therefore reproduces every observed $y_j$ exactly at its own node, and blends smoothly
between them elsewhere. See docs/lagrange_derivation.md for a full worked example.
Warning demonstrated by this lab: on the real, full Treasury grid, Lagrange can diverge by
thousands of percentage points in the wide 10Y-20Y gap (verified: DECISIONS.md). This is not
a bug -- it is what a single global polynomial genuinely does with unevenly spaced nodes. Compare
it against Linear/Cubic Spline/PCHIP in the chart above.
Leave-one-maturity-out validation: each interior maturity is removed, re-estimated from the rest, and compared to its real observed value.
PCA on daily yield changes, 2016-01-04 to 2026-09-08
- PC1 (Level): 72.6% of variance
- PC2 (Slope): 10.6% of variance
- PC3 (Curvature): 9.1% of variance
Together, the first three components explain 92.2% of daily yield-curve variation.
Labels above were assigned from the shape of the fitted loadings, not assumed from component
order: a component is called "Level" only if its loadings are the same sign across every
maturity, "Slope" only if they change sign exactly once (short vs. long), and "Curvature" only
if they change sign twice (a hump/U-shape). See models/pca_analysis.describe_loadings.
Component sign is arbitrary -- a component and its negation represent the identical factor.
PCA here runs on raw, unscaled yield changes (not standardized), matching standard fixed-income practice (Litterman & Scheinkman, 1991): scaling would artificially equalize the naturally higher day-to-day volatility of short-end yields against the long end, distorting the level factor's interpretation.
Historical anomaly analysis (curve shape, 2016-2026)
Today's curve (2026-09-08) ranks in the 1.3th percentile of historical unusualness (0 = most unusual ever observed in this window, 100 = most typical).
Isolation Forest fit on standardized daily yield levels (not changes -- a separate question from the PCA tab above) across 11 maturities and 2671 trading days.
A statistical anomaly is not automatically a crisis, and not a trading signal. It only means this curve shape is rare relative to the last ~10 years of history. See the Responsible-Use tab.
Lagrange vs. linear, evaluated across the entire history at once
Evaluates Lagrange vs. linear interpolation on a dense 2,000-point maturity grid, for every
day in the bundled history at once -- not just the one or two dates shown elsewhere in this
app. Because every day shares the identical maturity grid, this reduces to a single
(days x nodes) @ (nodes x grid_points) matrix multiply rather than a per-day loop.
Honest framing: the real speedup here is from vectorization, not specifically from GPU hardware -- measured directly: our existing per-day Python implementation would take approximately 23 minutes for this computation; the vectorized batch form takes a fraction of a second even on CPU. GPU adds a further, more modest boost on top at this problem size. This tab exists to give this account's mandatory ZeroGPU allocation genuine work to do, not to claim GPU hardware was strictly necessary here.
What is a yield curve?
A plot of interest rates (yields) on comparable debt (here, U.S. Treasuries) across different maturities on a single date. Its shape reflects market expectations about future interest rates, growth, and inflation.
What does interpolation mean?
Estimating a value between two or more observed data points. It says nothing about values outside the observed range (see "Interpolation vs. extrapolation" below), and nothing about future dates (see "Interpolation vs. forecasting" below).
How does Lagrange interpolation work?
It builds the one polynomial that passes exactly through every observed point, using basis
polynomials that act as "switches" -- see the Interpolation Lab tab and
docs/lagrange_derivation.md.
Interpolation vs. extrapolation
Interpolation estimates a value inside the range of observed maturities (e.g., 4Y when you have 3Y and 5Y). Extrapolation estimates a value outside that range (e.g., 40Y when your longest observed maturity is 30Y) and is far less reliable -- this app warns explicitly whenever a request would require extrapolation.
Interpolation vs. forecasting
Interpolation never uses time. It estimates an unobserved maturity on a date that already happened, using data from that same date. It makes no claim whatsoever about what any yield will be tomorrow, next week, or next year. Forecasting is a distinct problem this app does not attempt.
Why can Lagrange become unstable?
A single polynomial through many unevenly-spaced points has only one job: pass through every point exactly. Where points are far apart (e.g., the real 10Y-20Y gap), nothing constrains the curve's shape in between, and a high-degree polynomial can swing wildly to satisfy every constraint at once (Runge's phenomenon) -- demonstrated with real numbers in this app's Interpolation Lab and Model Validation tabs.
How does PCA connect mathematics with machine learning?
PCA finds the directions (linear combinations of the original variables) along which the data varies the most. Applied to daily yield changes, the first few directions turn out to correspond to interpretable, economically meaningful patterns (level, slope, curvature) -- an example of an unsupervised ML technique recovering real structure, not just abstract math.
How could this support risk analysis?
Level/slope/curvature factors are a standard way fixed-income risk systems decompose interest rate risk (e.g., duration/key-rate-duration hedging). Anomaly detection offers a systematic, reproducible way to flag unusual market days for further (human) review -- a starting point for investigation, not a conclusion.
Responsible use
- This application is for education and research. It is not investment advice.
- Estimates have model risk. Every interpolation method here embeds assumptions (e.g., smoothness, shape-preservation) that may not hold on any given date.
- Market data may be delayed or revised. Treasury.gov publishes end-of-day data; this is not real-time.
- Anomaly scores are not trading signals. A statistically unusual curve shape is not a prediction, a recommendation, or evidence of an impending market event.
- Interpolation is not forecasting. Nothing in this application estimates a future yield.