Temporal Decomposition and Forecast split a time series graph into trend, seasonal, and remainder components.

Temporal Decomposition and Forecast apply the Seasonal-Trend decomposition using LOESS (STL) method to calculate the components of the time series.

## Example

An environmental organization is studying changes in air quality over time. They use Temporal Decomposition to determine how seasonality affects air quality and whether air quality is improving or worsening over time. They use Forecast to predict future air quality values.

## Run Temporal Decomposition

Complete the following steps to perform temporal decomposition:

- Create a map, chart, or table using the dataset with which you want to perform temporal decomposition.
- Click the Action button .
- Do one of the following:
- For a time series graph card, remain on the Temporal analysis tab.
- For a different chart type card or a table card, click How has it changed in the Analytics pane.
- For a map card, click the Find answers tab and click How has it changed.

- Click Temporal Decomposition.
- For Choose a layer, select the dataset to use to perform temporal decomposition.
- For Choose a date/time field, select the date/time field to use for the timeline.
- Expand Additional options and provide values for the Choose a number field, Adjust for seasonality, and Select window size parameters if necessary.
See the Usage notes section below for more information.

- Optionally, select Show forecast to include forecasted values on the timeline.
When Show forecast is selected, you can also adjust the Set forecast horizon cycles parameter to specify how many cycles are included in the forecast. The default number of cycles is 2.

- Click Run.

## Run the Forecast capability

Complete the following steps to perform forecasting:

- Create a map, chart, or table using the dataset with which you want to perform forecasting.
- Click the Action button .
- Do one of the following:
- For a time series graph card, remain on the Temporal analysis tab.
- For a different chart type card or a table card, click How has it changed in the Analytics pane.
- For is a map card, click the Find answers tab and click How has it changed.

- Click Forecast.
- For Choose a layer, select the dataset to use to perform forecasting.
- For Choose a date/time field, select the date/time field to use for the timeline.
- Expand Additional options and provide values for the Choose a number field, Adjust for seasonality, and Select window size parameters if necessary.
See the Usage notes section below for more information.

- Adjust the Set forecast horizon cycles parameter value to specify how many cycles are included in the forecast.
The default number of cycles is 2.

- Click Run.

## Usage notes

Temporal Decomposition and Forecast are accessed using the Action button under How has it changed on the Find answers tab or on the Temporal analysis tab on a time series graph. The input must be a dataset that includes a date/time field and must have a minimum of one year's worth of data. For more information, see the How Temporal Decomposition and Forecast work section below.

Use the Choose a date/time field parameter to select the date/time field that will have temporal decomposition applied.

Expand Additional options to access the Choose a number field, Adjust for seasonality, and Select window size parameters. The following table summarizes these parameters, including their default values:

Parameter | Description | Default value |
---|---|---|

Choose a number field | A field denoting the value of each observation on the time series. For example, when decomposing a time series of average global temperatures over time, use the temperature field for the Choose a number field parameter. | None. The value for each point is based on the count. |

Adjust for seasonality | Seasonality is used to determine how the seasonal component is calculated. The following seasonality options are available: - Weekly
- Monthly
- Quarterly
- Yearly
| None. Choose an appropriate seasonality based on the data. |

Select window size | The window size determines the percentage of data points used in the smoothing calculation. | 50%. |

For Temporal Decomposition, select Show forecast to create an output time series showing predicted future values based on the seasonal component and the seasonally adjusted component. The number of cycles in the forecast is based on the Set forecast horizon cycles parameter. The default value is 2. The Show forecast parameter is not available for Forecast because it is always enabled.

The results for Temporal Decomposition and Forecast include two datasets: one named STL and one named Forecast - STL (only included for Temporal Decomposition if Show forecast is enabled).

The STL dataset includes fields for the raw data (based on either the count or the number field used to decompose the time series), four components (Seasonal, Trend, Remainder, and Seasonally Adjusted), and the original date/time field.

The Forecast - STL dataset includes the original date/time field, as well as fields for the raw data (based on either the count or the number field used to decompose the time series), estimate, and upper and lower prediction intervals (80% and 95%).

## How Temporal Decomposition and Forecast work

Temporal Decomposition and Forecast use the STL method to decompose a time series into its seasonal, trend, and remainder components. The data requirements in the STL algorithm are based on the seasonality used to describe the seasonal component.

### Seasonality

Seasonality (also called periodicity) is used in STL to adjust for seasonal effects in a time series. For example, air quality tends to follow a yearly cycle with improved air quality in winter months and decreased air quality in summer months. Air quality data can be decomposed using monthly seasonality to adjust the time series for the recurring cycle of improved and reduced air quality to get a better idea of the overall trend in air quality over time.

Seasonality can be weekly, monthly, quarterly, or yearly. The data requirements for Temporal Decomposition and Forecast depend on the seasonality used.

For all of the seasonality options, the data is split into subseries. There must be at least one occurrence of every subseries in the dataset to use Temporal Decomposition or Forecast.

The following table summarizes the seasonality options and the subseries and data requirements for each:

Seasonality | Subseries | Data requirements |
---|---|---|

Weekly | Weeks 1 through 52. For example, January 1–January 7 is week 1, January 8–January 14 is week 2, and so on. | A minimum of 52 weeks' worth of data with at least one data point for each week. |

Monthly | Months January through December. | A minimum of 12 months' worth of data with at least one data point for each month. |

Quarterly | Quarters 1 through 4. | A minimum of four quarters' worth of data with at least one data point for each quarter. |

Yearly | Individual years. For example, if the dataset includes data starting in 2015 and ending in 2020, the subseries would be 2015, 2016, 2017, 2018, 2019, and 2020. | A minimum of four years' worth of data with at least one data point for each year. |

#### Seasonality example

You want to run Temporal Decomposition or Forecast using weekly seasonality for a dataset with data collected daily from January 2015 through December 2020. However, the system to collect data is shut down each year from January 1 through January 10 for updates and maintenance, so no data is collected during that period. To use weekly seasonality, the data must include at least one data occurrence for every week. Since week 1 (January 1 through January 7) is missing completely from the data, you cannot use weekly seasonality on the dataset. All other seasonality options are compatible with the dataset because it fits the minimum data requirements and has at least one occurrence for each monthly, quarterly, and yearly subseries.

To make the dataset compatible with weekly seasonality, the scheduled shutdown is changed to January 2 starting in 2021. The data collected on January 1, 2021, is part of the week 1 subseries, so the dataset now has at least one data point for each subseries.

##### Note:

The requirement for one data point per subseries is an overall requirement, not a yearly requirement. That's why the January 2, 2021, data point fulfills the requirement even though there is no data available for week 1 in 2015 through 2020.

### Prediction intervals

Prediction intervals are calculated by Forecast using the following equation from Hyndman and Athanasopoulos (2018, chap. 7):

`ŷ`_{T+h|T} ± cσ_{h}

Where:

- ŷ
_{t}=The average value of the forecast distribution at time t. - ŷ
_{T+h|T}=The cumulative forecast of ŷ_{t}up to time T for h forecast horizon cycles. - c=Coverage probability
- σ
_{h}=Square root of the forecast variance

## Limitations

Temporal Decomposition and Forecasting do not support time-only fields (date/time fields with a time component but no dates).

## References

Hyndman, Rob J., and George Athanasopoulos. 2018. Forecasting: Principles and Practice. 2nd ed. Melbourne, Australia: OTexts. OTexts.com/fpp2.