Forecasting

Run statistical forecasts on macroeconomic indicators.

Forecasting

The forecasting engine lets you run time-series models on any registered indicator directly through the API.

Available models

ModelFamilyBest for
ARIMAClassicalUnivariate series with trend and seasonality
ETSClassicalExponential smoothing with error/trend/season decomposition
VARMultivariateJoint forecasting of related series
Holt-WintersClassicalStrong seasonal patterns

Running a forecast

curl -X POST https://macrobymark.com/api/forecast/run \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "us-cpi-all-items",
    "model": "arima",
    "horizon": 12,
    "vintage": { "mode": "latest" }
  }'

The response includes point forecasts, confidence bands, model diagnostics, and a cache key you can use to export results.

Vintage-aware forecasting

You can run forecasts against historical data vintages to backtest how a model would have performed in real time:

curl -X POST https://macrobymark.com/api/forecast/run \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "us-cpi-all-items",
    "model": "arima",
    "horizon": 6,
    "vintage": { "mode": "specific", "date": "2024-01-15" }
  }'

FRED series support native vintage retrieval. BLS and BEA use simulated vintages derived from revision history. Other providers fall back to the current snapshot with a disclaimer in the audit metadata.

Exporting results

Use the cache key from the forecast response to download results:

# CSV
curl -G "https://macrobymark.com/api/forecast/run/{cacheKey}/csv" \
  -H "X-API-Key: YOUR_KEY"

# JSON
curl -G "https://macrobymark.com/api/forecast/run/{cacheKey}/json" \
  -H "X-API-Key: YOUR_KEY"