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. Temporal Decomposition can be used to determine how seasonality affects air quality and whether air quality is improving or worsening over time. Forecast can be used to predict future air quality values.

## Use the Temporal Decomposition capability

Complete the following steps to run the Temporal Decomposition analysis capability:

- 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:
- If your card is a time series graph, remain on the Temporal analysis tab.
- If your card is a different chart type or a table, click How has it changed in the Analytics pane.
- If your card is a map, click the Find answers tab and click How has it changed.

- Click Temporal Decomposition.
- For Choose a layer, select the dataset with which you want to perform temporal decomposition.
- For Choose a date/time field, select the date/time field you want to use for your timeline.
- Expand Additional options and enter values for the Choose a number field, Adjust for seasonality, and Select window size parameters, if necessary. See Usage notes for more information.
- Optionally, select Show forecast to include forecasted values on your timeline. If Show forecast is selected, you can also adjust the Set forecast horizon cycles parameter to determine how many cycles are included in the forecast. The default number of cycles is two.
- Click Run.

## Use the Forecast capability

Complete the following steps to run the Forecast analysis capability:

- 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:
- If your card is a time series graph, remain on the Temporal analysis tab.
- If your card is a different chart type or a table, click How has it changed in the Analytics pane.
- If your card is a map, click the Find answers tab and click How has it changed.

- Click Forecast.
- For Choose a layer, select the dataset with which you want to perform forecasting.
- For Choose a date/time field, select the date/time field you want to use for your timeline.
- Expand Additional options and enter values for the Choose a number field, Adjust for seasonality, and Select window size parameters, if necessary. See Usage notes for more information.
- Adjust the Set forecast horizon cycles parameter to determine how many cycles are included in the forecast. The default number of cycles is two.
- Click Run.

## Usage notes

Temporal Decomposition and Forecast can be found 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 How Temporal Decomposition and Forecast work.

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

Expand Additional options to reveal 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 | The seasonality is used to determine how the seasonal component is calculated. The following seasonality options are available: - Weekly
- Monthly
- Quarterly
- Yearly
| None. An appropriate seasonality is chosen based on your 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 called STL and one called 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, plus 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. Therefore, 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 which seasonality is 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 your 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. |

#### 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, your data must include at least one data occurrence for every week. Since week 1 (January 1 through January 7) is missing completely from your 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 the Forecast capability 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 (in other words, 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.