nachosanbenito.com GitHub

Inflation Forecaster

Beats a random walk one month ahead. Loses after that.

A seasonal ARIMA model on 79 years of US prices, tested month by month against forecasts that need no model.

US inflation since 1948, and the model's next 12 months

Year-on-year change in consumer prices, %. Shaded: the 80% band of the SARIMA forecast. Dotted: the Fed's 2% target. Press play or drag the handles to travel back to 1948.

1948
Aug 2026
Source: U.S. Bureau of Labor Statistics via FRED (CPIAUCSL), data to Aug 2026. No CPI was published for Oct 2025, hence the gap.Model: SARIMA(1,1,2)(0,1,1)12 on log CPI

The whole project in 52 seconds.

Real data in, a model chosen by AIC, an honest backtest and a forecast that admits what it can't know.

  • Data955 months, FRED
  • Inflation today3.71%, Aug 2026
  • Central forecast3.39%, Aug 2027

How the forecast is built

Prices from the Bureau of Labor Statistics, monthly since January 1947. The model does not see inflation directly. It works on the log of the price level, then converts back to inflation, the change against the same month a year earlier.

(1 − φ1B)(1 − B)(1 − B12) ln CPIt
= (1 + θ1B + θ2B2)(1 + Θ1B12) εt

SARIMA(1,1,2)(0,1,1)12. B means "one month back": B·xt = xt−1, and B12 is the same month last year.

(1 − B)(1 − B12)
Removes the trend and the yearly pattern, so what is left has no drift. ADF test on Δ ln CPI: p = 0.0001.
φ1
This month's change echoes last month's.
θ1, θ2
Corrects for the surprises of the last two months.
Θ1
Corrects for the surprise in the same month last year.

The order is chosen by AIC, not by hand

Seven candidates fitted on the full sample. AIC rewards fit and charges for every extra parameter. Bars show how much worse each one is than the winner.

    Note: the last candidate is cut; its ΔAIC is 3,750, a fit that did not converge well.

    Checks on what the model leaves behind

    Ljung-Box, 12 lagsp above 0.05: no pattern left in the errorsp = 0.995
    Ljung-Box, 24 lagsp = 1.000
    ADF on Δ ln CPIp below 0.05: the differenced series is stationaryp = 0.0001
    One-month biasmean of actual minus forecast, 36 months−0.028 pp

    In plain words: what the model gets wrong looks like random noise, so it has squeezed out the pattern in past prices. It is not systematically too high or too low.

    The race against forecasts that need no model

    For each of the last 36 months, the model only sees data up to that month and forecasts 1, 3, 6 and 12 months ahead. Two rivals do the same with no model at all. Random walk: inflation stays where it is. Seasonal naive: inflation is what it was a year before. Score: RMSE = √(mean of (actual − forecast)²), in percentage points.

    Forecast 1 month ahead vs what happened

    ActualSARIMARandom walkSeasonal naive

    Error so far (RMSE, pp). Lower wins. A cut bar runs off the scale.

    Aug 2023
    Aug 2026
    Backtest: walk-forward, Aug 2023 to Aug 2026, parameters fitted once before the windowData: FRED CPIAUCSL
    HorizonSARIMARandom walkSeasonal naive

    The model wins only at one month: 0.234 against 0.270, about 13% less error. From three months on, "inflation stays where it is" is better, and at twelve months it is ahead by 0.28 points. That is the classic Atkeson and Ohanian (2001) result: for inflation, a random walk is very hard to beat.

    13%less error than the random walk, 1 month ahead
    0.28 ppmore error than the random walk, 12 months ahead

    Where it fails

    The forecast for August 2027 is 3.39%. The number that matters more is the band around it.

    5.2 pp

    The 12-month band is 5.2 points wide

    80% of outcomes between 0.84% and 6.01%. At that horizon the band is the honest answer, not the line.

    3 of 4

    It loses from three months on

    A random walk wins at 3, 6 and 12 months. Use the model for next month's print, not for next year.

    It only knows past prices

    No oil, wages, interest rates or Fed decisions go in. A shock that is not in the price history is invisible to it.

    The test window is short

    36, 34, 31 and 25 forecasts per horizon, all from one period (2023 to 2026). Another decade could rank them differently.

    Parameters are fitted once

    The backtest re-filters the data month by month but does not refit, which is fast and leak-free but slightly kinder to drift.

    Seven candidates, not a full search

    The order comes from a curated shortlist of the usual seasonal models, not an exhaustive grid.

    Run it yourself

    The full app is a step-by-step working paper that runs the model live on CPI, Core CPI, PCE or Core PCE. It needs a small Python server, so it is not hosted here.

    git clone https://github.com/nachoie123/inflation-forecaster
    cd inflation-forecaster
    pip install -r requirements.txt
    python3 server.py   # http://localhost:8000

    Python, statsmodels and a standard-library web server. MIT licence. FRED data, no API key.