Outliers in time series data are values that significantly differ from the patterns and trends of the other values in the time series. For example, large numbers of online purchases around holidays or high numbers of traffic accidents during heavy rainstorms may be detected as outliers in their time series. Simple data entry errors, such as omitting the decimal of a number, are another common source of outliers. Identifying outliers in time series forecasting is important because outliers influence the forecast model that is used to forecast future values. Even a small number of outliers in the time series of a location can reduce the accuracy and reliability of the forecasts. Locations with outliers, particularly outliers toward the beginning or end of the time series, may produce misleading forecasts. Identifying these locations helps you determine how confident you should be in the forecasted values at each location.

You can identify outliers at each location of a space-time cube using the Curve Fit Forecast, Exponential Smoothing Forecast, and Forest-based Forecast tools by specifying the Identify outliers option of the Outlier Option parameter.

## Visualize and explore outliers

After running one of the forecasting tools using the option to identify outliers, you are provided information about the detected outliers through output feature symbology, time series charts, 2D or 3D visualization of the output space-time cube, and geoprocessing messages.

### Pop-up charts

Clicking an output feature on the map produces a pop-up chart in the Pop-up pane that displays the time series and forecast model with identified outliers displayed as large points. The following image shows the time series of a feature in which one outlier was identified:

### Visualize the space-time cube

The outliers in a space-time cube can be visualized and explored in 2D and 3D using the Visualize Space Time Cube in 2D and Visualize Space Time Cube in 3D tools using the Time series outlier results option of the Display Theme parameter.

For 2D feature output, the output features are symbolized by the number of outliers at each location and contain the same pop-up charts displaying the time series and identified outliers.

For 3D feature output, the output features display the locations and times of the identified outliers in a 3D scene. Any space-time bin whose value is identified as a time series outlier is labeled as Above Fitted Value or Below Fitted Value, depending on whether the value is above or below the fitted values of the forecast model. Outliers above the fitted value display in purple, and outliers below the fitted value display in green. Space-time bins not identified as outliers are labeled Not an Outlier and display in light gray.

The 3D features also include two charts. The Visualize in 3D Time-Series chart displays a line plot of the average value of the time series across the time steps of the space-time cube. This chart is also created by the Forecast results option of the Display Themes parameter and does not contain information related to outlier detection.

The second chart is the Count of Outliers Above or Below Fitted Value Over Time chart. This chart is a stacked bar chart displaying the total number of outliers above and below fit at each time step of the space-time cube. This allows you to identify important dates when many outliers occurred, and you can see if the values on these dates were unusually high or low.

### Geoprocessing messages

The geoprocessing messages include a Summary of Time Series Outliers section. The first part of this section shows the number and percent of locations containing at least one outlier. This allows you a quick sense of how well the forecast model fits the time series overall. The second part displays summary statistics (minimum, mean, and maximum) of the number of outliers per location and per time step. This allows you to investigate how frequently outliers occurred at individual locations and individual time steps. This section also displays the time step containing the largest number of outliers. You can use this to identify important dates when many outliers occurred.

## Contextual and global outliers

There are a few types of time series outliers that may be detected by the tool. While all types are detected in the same way, understanding the types helps clarify why certain time steps were identified as outliers and other time steps were not.

The simplest type is global outliers whose raw values are significantly larger or smaller than the rest of the values. These outliers often correspond to anomalies or special events such as holidays. The chart below shows a global outlier. The identified outlier has a significantly higher value than the rest of the data in the times series and was identified because of this.

However, values do not need to be among the largest or smallest in the time series to be declared outliers. Instead, some outliers are identified based on context, by having a significantly higher or lower value than you would expect based on the patterns and trends of the time series. The forecast model incorporates these patterns and trends, and it serves as the baseline for identifying contextual outliers. For example, consider a time series of annual mean temperature. Because average temperatures have increased over the last several decades, the fitted forecast model of temperature also increases over time to reflect this increase. This means that a temperature value that would be considered typical and not an outlier in 1950 would likely be considered an outlier if the same temperature occurred in 2020. In other words, a typical temperature from 1950 would be considered low by the standards of 2020.

The chart below shows a time series with both a contextual outlier and a global outlier. The value of the contextual outlier is not the smallest in the time series, but it was identified as a low value outlier because it fell farthest below the orange forecast model.

Whether values are identified as outliers also depends on how well the forecast model fits the time series. If the forecast model generally fits the time series data closely, values that deviate even slightly from the forecast model can still be identified as outliers. Similarly, if the forecast model does not fit the time series data well, even large deviations from the forecast model may not be identified as outliers.

The chart below shows several values identified as outliers. These values do not appear to deviate far from the orange forecast model, but their deviation is much greater than the rest of the values in the time series.

## Generalized ESD test for time series outliers

The Generalized Extreme Studentized Deviate (ESD) test is used to test for the presence of outliers at each location of the space-time cube. This test is not one test; it is a sequence of tests (each called a Grubbs' test), each of which checks for a specific number of outliers at the specified confidence level. The first test checks for the presence of exactly one outlier in the dataset. The second tests for exactly two outliers. The third tests for exactly three. This continues up to the value of the Maximum Number of Outliers parameter (by default, 5 percent of the number of time steps, rounded down). The tool then returns the outliers associated with the largest statistically significant number of outliers. For example, using a maximum of three outliers, if the test for one outlier is statistically significant, the test for two outliers is not significant, and the test for three outliers is significant, the tool returns three outliers. Similarly, if one outlier is significant, two outliers is significant, and three outliers is not significant, the tool returns two outliers.

For a time series with *T* fitted time steps, the test proceeds as follows where *i* ranges from 1 to the maximum number of outliers:

- Calculate the residuals of each time step
*t*by subtracting the value of the forecast model from the raw value: - Calculate the mean and standard deviation of the residuals.
- Calculate the test statistic by dividing maximum absolute deviation from the mean by the standard deviation:
- Compare the test statistic to the following critical value: , where
*t*is the two-sided critical value of the t-distribution with_{ α,T-i-1 }*T-i+1*degrees of freedom at confidence level*(1 - α / (2(T-i+1)))*and*α*is the significance level (determined by the confidence level). - If the test statistic is larger than the critical value, the test for exactly
*i*outliers is statistically significant. - Remove the value associated with the maximum absolute residual, and repeat steps 2 through 5 on all time steps that have not been previously removed, also increasing
*i*by one. The mean and standard deviation of the residuals changes by removing the value at each repetition. This recalculation of the mean and standard deviation corrects for the influence of the outliers on the forecast model. - Return the outliers associated with the largest number of outliers that were statistically significant.

Because this test is performed independently at each location of the space-time cube, different locations may identify different numbers of outliers. The number of outliers at each location can be seen in the Number of Model Fit Outliers field of the output features.

## Best practices and limitations

There are several important considerations and limitations when identifying time series outliers:

- If you are using the Forest-based Forecast tool, it is recommended that you provide a value for the Time Step Window parameter rather than leaving the parameter empty and estimating a different time step window at each location. For each location, the forest model uses the values in the first time step window to train the forecast model, and outliers are only detected for the remaining time steps. If different locations exclude different numbers of time steps for training the forest, summary statistics such as the mean, minimum, and maximum number of outliers per time step or per location may be misleading.
- The Generalized ESD test uses approximations to estimate the critical value. These approximations are most accurate for time series with at least 25 time steps.
- Using different forecast models and forecasting tools may identify different time steps as outliers. It is recommended that you only detect outliers for the forecast model that best fits the values of the time series.

## Additional resources

For more information about the Generalized ESD test and Grubbs' test, see the following references:

- Grubbs, F. (1950). "Sample Criteria for Testing Outlying Observations." Annals of Mathematical Statistics 21(1):27–58. https://doi.org/10.1214/aoms/1177729885
- Rosner, B. (1983). "Percentage Points for a Generalized ESD Many-Outlier Procedure." Technometrics 25(2):165–172.

#### Related topics

- An overview of the Space Time Pattern Mining toolbox
- An overview of the Time Series Forecasting toolset
- Curve Fit Forecast
- Exponential Smoothing Forecast
- Evaluate Forecasts By Location
- Forest-based Forecast
- How Curve Fit Forecast works
- How Exponential Smoothing Forecast works
- How Forest-based Forecast works
- Forest-based and Boosted Classification and Regression
- How Forest-based and Boosted Classification and Regression works