weltby Ergodic Sign inGet started
All use cases

Will US Unemployment Be Higher in Three Months?

Forecasting tournaments and prediction markets ask questions like this every week: will a public number be above its latest value on a given date? Answering well means putting a probability on it, and a probability needs a forecast with a range, not a single guess.

Use caseFinanceForecastingPrediction

The table

The US civilian unemployment rate from FRED: one row per month since January 1948, about 945 rows, with two columns, the date and the rate. It's free to download with no account.

Walkthrough

  1. Download the series

    Read FRED's CSV straight into pandas.

    import pandas as pd
    
    url = "https://fred.stlouisfed.org/graph/fredgraph.csv?id=UNRATE"
    rate = pd.read_csv(url, parse_dates=["observation_date"])
  2. Forecast three months with a range

    Ask Chronos-2 for several quantiles, so you can see the whole spread of outcomes.

    from welt import Forecast
    
    levels = [0.05, 0.1, 0.5, 0.9, 0.95]
    model = Forecast(model="chronos-2").fit(
        rate, time="observation_date", target=["UNRATE"], frequency="MS")
    month3 = model.forecast(3, quantile_levels=levels).to_frame().iloc[-1]
  3. Turn the range into a probability

    Find where today's rate falls inside the forecast's spread. The share of outcomes above it is the probability of "higher".

    import numpy as np
    
    today = rate["UNRATE"].iloc[-1]
    values = [month3[f"q_{q}"] for q in levels]
    p_higher = 1 - np.interp(today, values, levels)
    print(f"Chance unemployment is higher in three months: {p_higher:.0%}")

What you get

A probability for the questionReady to submit, trade on or report.
The reasoning behind itThe forecast's range shows how much the number could move.
A repeatable methodThe same three steps answer any question about a public series.

Try it

Use Open with to run the forecasting notebook in Colab, Kaggle or Jupyter and swap in the FRED series, or run the code above after pip install "welt-client[parquet]".