Time series outlier detection: Determine if a forecast is an outlier I checked some similar questions but I could not find anything in particular that would work for my case.
I have time series data that is being used to make a prediction. Within that predication/forecast there are assumptions that are NOT captured by the input data.
I want to write an detection algo that determines if the forecast makes sense relative to the input data. However, in the input time series data, the data could be increasing in value overtime, or their could be a rush order that causes the subsequent forecast to be higher. I would like to put weight or emphasis on the more recent time data
Does anyone have any tips? I would like to do this in R
 A: You could pull several time series features from your input and compare to the forecast itself.
For example, you could take the weighted average (weighting more recent points more) of your input and make sure the average of the forecast is within some reasonable percentage like 20%.
You could also do something similar with a trend line (once again weighting more recent points more by doing WLS or something) and compare that to the coefficient for the trend line in the forecast.
Other things could be simple seasonality tests and making sure the forecast is using seasonality and it wasn't optimized (I have no idea what your methods are) to not have seasonality or vice versa.
You could take a look at tsfeatures for any other relative features to compare.
I would just use several pieces of logic like this to surface potentially bad forecasts based on what 'makes sense' for you.
A: If you don’t want your model to make assumptions inconsistent with the data, don’t use such a model. To detect an outlier, you would fit some model to your data and use it to decide how likely are the observations (here, the forecast) are according to the model. So technically, you would be comparing predictions of two models. Why not just use a model that doesn’t make additional assumptions in the first place?
