---
url: https://jer-k.github.io/effect-prophet/guide/reading-forecasts.md
description: >-
  The fields predict returns for each forecast, including the trend and the
  additive and multiplicative components.
---

# Reading a forecast

`predict` returns one forecast for each row you asked about. Each forecast contains:

| Field            | Meaning                                                                     |
| ---------------- | --------------------------------------------------------------------------- |
| `timestamp`      | The date as a number of milliseconds. Use `new Date(timestamp)` to read it. |
| `value`          | The forecast itself                                                         |
| `trend`          | The long-term trend's share of the value                                    |
| `seasonalities`  | One entry per seasonal pattern, such as `weekly` or `yearly`                |
| `events`         | One entry per holiday or event                                              |
| `regressors`     | One entry per extra factor                                                  |
| `additive`       | All additive pieces added up                                                |
| `multiplicative` | All multiplicative pieces added up, as a fraction (0.1 means +10%)          |

## Example

```ts
import { Effect } from "effect";
import { fit, predict, prophetFittingBackendLayer } from "effect-prophet";

const history = Array.from({ length: 90 }, (_, day) => ({
  timestamp: new Date(Date.UTC(2025, 0, 1 + day)).toISOString(),
  value: 100 + day * 0.5 + 10 * Math.sin((2 * Math.PI * day) / 7),
}));

const forecast = await Effect.runPromise(
  Effect.gen(function* () {
    const model = yield* fit(history);

    return yield* predict(model, ["2025-04-01T00:00:00.000Z"]);
  }).pipe(Effect.provide(prophetFittingBackendLayer)),
);

const [row] = forecast;

if (row !== undefined) {
  console.log("date:", new Date(row.timestamp).toISOString());
  console.log("forecast:", row.value.toFixed(2));
  console.log("trend:", row.trend.toFixed(2));

  for (const seasonality of row.seasonalities) {
    if (seasonality.mode === "additive") {
      console.log(`${seasonality.name}:`, seasonality.value.toFixed(2));
    }
  }
}

```

```txt [Output]
date: 2025-04-01T00:00:00.000Z
forecast: 137.18
trend: 145.00
weekly: -7.82
```

On this day the trend alone predicts 145. Tuesday is a quiet day of the week, so the weekly
pattern takes away 7.82, leaving a forecast of 137.18.

## Additive and multiplicative pieces

Most pieces are **additive**: they add or subtract a fixed amount, like "+20 sales on Saturdays".
Their entries have a `value`.

A piece can also be **multiplicative**: it changes the value by a percentage, like "+15% on
Saturdays". Their entries have a `factor` (0.15 means +15%) and a `contribution`, which is the
same effect converted into your data's units. See
[Seasonality](../examples/seasonality#effects-that-grow-with-the-trend).

The pieces always add back up:

```txt
value = trend × (1 + multiplicative) + additive
```
