Skip to content

Repository files navigation

Forecasting U.S. Treasury Yields

tests

Auditing simple fixed-income forecasting models

This is a fixed-income quant research project on forecasting the 10-year U.S. Treasury yield, with an emphasis on disciplined out-of-sample evaluation. The core question is not just whether a model can be fitted, but whether it can beat a simple random-walk benchmark without using future information.

Key takeaway

I tested whether simple ARIMA and yield-curve regression models could beat a random-walk benchmark for 20-observed-business-day-ahead DGS10 forecasts.
None of the simple models improved on the benchmark during validation.
A Newey-West-adjusted forecast comparison showed that ARIMA performed statistically worse than random walk under overlapping forecast errors.

Research question

Can simple time-series or yield-curve models improve 20-observed-business-day-ahead DGS10 forecasts relative to a random-walk baseline?

Current validation result

On the 2016-2020 validation period, the random-walk baseline remained the strongest model tested so far.

Model Validation MAE (bp) Validation RMSE (bp) Bias (bp)
Random Walk 14.22 19.45 1.86
ARIMA(1, 1, 0) 14.59 20.04 1.96
Ridge Regression 16.80 22.52 11.00
Linear Regression 17.75 23.46 12.76

Interpretation: neither univariate ARIMA nor simple yield-curve regression improved on the validation benchmark. The random-walk benchmark was therefore selected before final test evaluation.

This does not mean that Treasury yields are impossible to forecast, or that a random walk is always the best model in practice. The narrower finding is that, for this dataset, horizon, feature set, and out-of-sample design, the simple models tested here did not add enough predictive value over a strong persistence-based benchmark.

Statistical forecast comparison

Because the project uses overlapping 20-observed-business-day forecast horizons, the validation forecast errors are serially dependent. To avoid overstating the difference between models, the ARIMA(1, 1, 0) forecast was compared with the random-walk benchmark using Diebold-Mariano-style tests with Newey-West standard errors and 19 lags.

Loss difference is defined as:

ARIMA loss - Random Walk loss
Loss function Mean loss difference Newey-West lags Test statistic p-value
Absolute error 0.37 bp 19 3.39 0.0007
Squared error 23.39 bp² 19 3.29 0.0010

The positive and statistically significant loss differences support the validation conclusion: ARIMA did not just lose by a small numerical margin; it performed worse than the random-walk benchmark after adjusting for overlapping forecast errors.

Final test result

On the untouched 2021-2025 test period, the selected random-walk benchmark produced weaker performance than it did on validation.

Sample Observations MAE (bp) RMSE (bp) Bias (bp)
Validation 1,230 14.22 19.45 1.86
Test 1,229 21.46 27.21 -4.99

The higher test error reflects a more challenging post-2020 rate environment, where DGS10 moved more sharply than during the validation period.

The test weakness was concentrated in the 2021-2022 hiking and transition regime.

Test subperiod Observations MAE (bp) RMSE (bp) Bias (bp)
2021-2022 hiking / transition 500 23.48 29.84 -9.80
2023-2025 stabilization / post-hiking 729 20.08 25.24 -1.69

This regime split supports the interpretation that persistence-based forecasts can lag sharp directional shifts. The random-walk model was less biased once the post-hiking environment became more stable.

Interpretation

The main lesson from this project is that a simple benchmark can be difficult to beat in financial time-series forecasting. Treasury yield levels are highly persistent, so predicting that the 10-year yield will remain near its current level is often a strong starting point for short-horizon level forecasts.

The ARIMA models tested here were close to the random-walk baseline, which is expected because differenced ARIMA specifications often behave similarly to persistence-based forecasts. The feature-based regression models performed worse because the current yield-curve variables produced smooth, biased change forecasts and did not capture large moves in the validation period.

This result should be interpreted carefully:

  • It does not prove that Treasury yields cannot be forecast.
  • It does not prove that random walk is always the best model.
  • It does show that simple ARIMA and basic yield-curve regression were not enough to beat the benchmark under this disciplined validation/test setup.

Richer future models would likely need additional macro-financial information, such as policy expectations, inflation surprises, labor-market data, term-premium estimates, volatility measures, or event timing around FOMC and major macro releases.

Data and target

  • Source: Local FRED Treasury yield CSV downloads.
  • Series used: DGS2, DGS5, and DGS10.
  • Features: Yield-curve level (mean of DGS2, DGS5, and DGS10), 10-year minus 2-year slope, and 5-year curvature.
  • Target: DGS10 20 observed Treasury business days ahead.
  • Change target: 20-observed-business-day DGS10 change in basis points.
  • Cleaned sample: 6,502 observed Treasury yield rows.

Chronological split

Split Forecast-origin period Rows Target-date constraint
Train 2000-01-03 to 2015-12-02 3,983 target date no later than 2015-12-31
Validation 2016-01-04 to 2020-12-02 1,230 target date no later than 2020-12-31
Test 2021-01-04 to 2025-12-02 1,229 target date no later than 2025-12-31

The forecast-origin end dates are earlier than the calendar split end dates because each row predicts 20 observed business days ahead.

Raw CSV files are intentionally excluded from version control. They can be rebuilt from FRED after setup:

download-treasury-yields --raw-dir data/raw

If the console script is not installed, the same downloader can be run as a module:

PYTHONPATH=src python -m treasury_yields.fetch --raw-dir data/raw

Notebook workflow

  1. 01_data_preparation.ipynb
    Loads raw yield data, creates level, slope, and curvature factors, adds the 20-observed-business-day target, and verifies chronological splits.

  2. 02_naive_baseline.ipynb
    Establishes the random-walk benchmark on the validation set.

  3. 03_arima_model.ipynb
    Tests simple expanding-window ARIMA models against the random-walk baseline.

  4. 04_feature_regression.ipynb
    Tests linear and ridge regression models using yield-curve level, slope, and curvature features. Ridge alpha is selected on validation MAE from [0.1, 1.0, 10.0, 100.0].

  5. 05_final_test_evaluation.ipynb
    Evaluates the selected random-walk benchmark once on the untouched 2021-2025 test set and breaks test performance into hiking and post-hiking regimes.

  6. 06_statistical_tests.ipynb
    Runs Diebold-Mariano-style forecast comparisons with Newey-West standard errors to account for overlapping 20-day forecast horizons.

Repository structure

data/
  raw/                 Local FRED CSV files
  processed/           Reserved for analysis-ready derived files
notebooks/             Reproducible research notebooks
reports/figures/       Generated charts
src/treasury_yields/
  data.py              Data loading, cleaning, features, and target creation
  fetch.py             FRED data download helper and CLI entry point
  model.py             Baseline model definitions
  evaluate.py          Chronological splits and error metrics
tests/
  test_data.py          Data loading and target creation tests
  test_evaluate.py      Split leakage and metric tests
  test_model.py         Forecasting helper tests

Tracked summary figures:

Setup

python -m venv .venv
source .venv/bin/activate
pip install -e .

If local editable imports fail in a notebook or terminal environment, run from the repository root and add src/ explicitly:

export PYTHONPATH=src

The notebooks also add src/ to sys.path directly so they remain runnable in local notebook environments.

Tests

The lightweight unit tests use Python's standard unittest framework and can be run without adding a separate test dependency:

PYTHONPATH=src python -m unittest discover -s tests

Key lessons so far

  • A simple random-walk forecast is a strong benchmark for persistent Treasury yield levels.
  • ARIMA models produced validation errors close to the baseline, but did not improve on it; Newey-West-adjusted forecast comparison tests showed that the ARIMA loss was statistically higher.
  • Linear and ridge regression models using current yield-curve features underperformed the baseline and showed a positive validation bias, even after selecting ridge alpha on validation MAE.
  • Representing the curve with level, slope, and curvature removes the exact linear redundancy caused by combining raw yields with their deterministic transformations; moderate factor correlation remains.
  • Final test performance was weaker than validation performance, especially during the 2021-2022 hiking and transition regime.
  • The correct conclusion is limited and evidence-based: simple models failed to improve on the benchmark here, not that yield forecasting is impossible in general.

Important caveat

This project is for research and learning only. It is not investment advice.

About

US Treasury yield forecasting: random-walk benchmark · ARIMA/regression models · DM test with Newey-West errors · regime analysis

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages