# Forecasting

The baseline forecast: its methods, monthly seasonality, the forecast per customer, when the p10 to p90 band appears, the month-end forecast and plan access.

AI Spendbook documentation, Analysis & planning. Web page: https://www.aispendbook.com/docs/forecasting

The **Baseline** tab of Forecast & scenarios projects monthly AI spend six months ahead from up to 24 months of history. It is an extrapolation of past spend, not a predictive model: launches, price changes and migrations are not in it. Use [scenarios](https://www.aispendbook.com/docs/scenarios) for those.

## What it uses

Monthly spend on the spend basis: for each UTC day and provider, billed spend where the provider has billed, otherwise the provider usage estimate, otherwise the telemetry estimate. The bases never overlap and are never added together. Allocated spend per customer is not an input.

## Method

| Method | When | What it does |
| --- | --- | --- |
| Log-linear trend with monthly seasonality | 13 or more complete months with spend | Fits the trend on deseasonalized spend and applies a monthly seasonal index. |
| Log-linear trend (OLS) | 3 to 12 complete months with spend | Fits a constant monthly growth rate to the logarithm of monthly spend. |
| Flat daily run rate | Fewer than 3 complete months | Average daily spend over all observed days, times the days in each future month. No trend. |
| Insufficient data | No spend history | No projection. |

- The current month is added to the fit at its run rate (spend so far scaled to the full month) once 7 or more days have data. With fewer days it is left out.
- When history starts mid-month, that first month is scaled up to a full month from the days it covers, or left out when it covers under 7 days, so a short first month does not look like growth.
- Months with zero spend are left out of the log-linear fit.
- A p10 to p90 band is shown only when 4 or more points are fitted (the current month at its run rate can be one of them). It comes from the spread of the fit's errors and assumes they are normal. With less history each month is a single p50 figure, noted as "insufficient history for uncertainty".

## Seasonality

- The baseline reads up to 24 months of history. With 13 or more complete months it fits the trend on deseasonalized spend and applies a monthly seasonal index. The index for each month of the year is on the Baseline tab, with a note naming months seen only once, whose index rests on one year.
- The p10 to p90 range keeps the error of the trend without seasonality. Under 13 months nothing changes.
- A seasonal index can't tell a seasonal month from a one-off one.

## Forecast by customer

- The By customer tab gives the top customers by AI cost (10 by default) their own baseline, and every other customer one Other customers row. AI cost per customer is the allocated AI cost on each month's customer margin report.
- Each row shows its backtest mean absolute error. The forecast is stored once a day with the daily forecast record and scored per customer once its months end. It downloads as CSV or Excel.
- Spend with no customer ID is in no row. Months are calendar months, even on a retail calendar.

## What you see

- Four cards: **Last full month** and **Run rate this month** (observed), **Next month (p50)** with its band, and the last month of the horizon with the fitted monthly growth.
- A chart of observed spend (solid), the projection (dashed) and the band. A hollow point marks spend so far this month.
- An Observed panel (months of history, points fitted, notes) and an Assumed panel (method, assumptions, limitations), both as returned by the API.

## Month-end forecast

The **Month-end forecast** on the Overview is a separate calculation: spend through yesterday plus the average daily spend of the trailing 7 complete days times the days left. Its range uses the lowest and highest single day in those 7 days. It never shows less than the spend already recorded.

## Records and accuracy

A scheduled job stores the baseline once per UTC day with its information cutoff, and each record is scored once its months end. A backtest gives accuracy figures before that. See the [decision record](https://www.aispendbook.com/docs/decision-record).

## Official forecast and actuals

- A saved scenario can be made the official forecast and is scored next to the baseline. The baseline or a scenario can also seed next year's phased budget. See [budget plans](https://www.aispendbook.com/docs/budget-plans).
- Monthly actuals by provider, accounting class, customer or feature download as CSV or Excel for a planning model, with billed and estimated kept apart. See [exports and feeds](https://www.aispendbook.com/docs/exports-and-feeds).

## Access

- Forecasting is in the Growth plan and above. The Overview month-end forecast is in every plan.
- Viewers and above can read forecasts. Members limited to specific projects cannot, because the forecast covers the whole workspace.
