Forecast error is the difference between an observed value and the value predicted for the same time point. In outlier detection, unusually large errors indicate observations that differ substantially from expectation. section 17.2.6
A forecasting model can incorporate recent values, ruptures, trends, and cycles. Interpret an error relative to normal errors, for example by comparing it with the median error and median absolute deviation. section 17.2.6
A practical workflow is:
- Forecast each value from prior observations using a time-series or regression model. section 17.2.6
- Calculate the difference between each forecast and its actual value. section 17.2.6
- Compare errors with their usual scale rather than treating every nonzero error as anomalous. section 17.2.6
A large deviation
If the forecast is 50 and the observed value is 240, the error is 190. When typical errors are around 10 or 20, this observation is a candidate outlier. section 17.2.6
Listing 17.7 Forecasting values using Darts with ARIMA
from darts import TimeSeries from darts.models import ARIMA df['timestamp'] = df.index #1 series = TimeSeries.from_dataframe(df, "timestamp", "Values") model = ARIMA(p=7, d=2, q=2) #2 model.fit(series[:-60]) pred = model.predict(60) #3 pred.plot(label="forecast", low_quantile=0.05, high_quantile=0.95) #4 plt.legend() plt.show()
Fits ARIMA on earlier values and predicts a held-out interval, providing forecasts from which errors can be calculated. section 17.2.6

