I used the function auto.arima to predict sales for the next year. When using only 3 years of the dataset, my results were not good. When I go back 10 years, it improved. However, in order for me to have a normal distribution of the residuals, or have the ACF inside the confidence interval that considers the errors as 0, I need to remove a few outliers. My question is: can I even remove outliers from a residuals plot? Because if I do remove then, it seems like I am removing the points that shows the biggest flaws of my model and I am not sure if it continues to be valid then.

s <- ts(data$sales, frequency = 12) 
fit <- auto.arima(s)

Outliers are observations that are drawn from a different distribution (process) than the majority of the data.

If you are removing points that are from a distinct process than the one that you are trying to model, then it is generally acceptable to remove them or model them somehow if that is feasible.

If you can justify your decision to remove those points with a convincing story (you know that there was an error in the way that data was recorded, etc) then I think you can remove them. If you can't explain them at all, then there is more obligation to understand what they tell you about the general process that you are studying that you don't understand yet.

There are many methods for automatically detecting outliers, and a whole discipline called robust statistics devoted to developing these methods. A quick search finds, for example, this robust arima package for R. An advantage of using automated outlier detection methods is that the assumptions underlying them are usually well documented. This does not mean they are always right, but at least it is possible to find out more or less exactly why they are removing certain points. If done by our intuition, this sort of back tracing can be impossible.

  • $\begingroup$ Thank you for your reply. I understand what you mean. But it seems like you are mentioning the approach of dealing with outliers in an initial stage. What was done here, however, it is to use a ARIMA model for prediction using all datapoints of the dataset as input. However, in the end, when it came to the evaluation part, a few datapoints from the residuals plot were considered too far away from the others, and thus, eliminated. So I wonder if your explanation is also valid when we are talking about eliminating only residuals datapoints when the model was created with every single datapoint. $\endgroup$ – jessirocha Jan 20 at 13:26
  • $\begingroup$ The approach you are advocating is nothing more than data dredging and it invalidates the analysis. Pick a robust method that does not allow large influence from extreme observations and stick with the results. $\endgroup$ – Frank Harrell Jan 20 at 13:35
  • $\begingroup$ Thank you Frank! I thought so, just wanted to be sure. $\endgroup$ – jessirocha Jan 20 at 14:12
  • $\begingroup$ The residuals are a reflection of how the model fits the data. It is possible that there is enough data and their "leverage" is so low that they are pretty much being ignored in the fit. However, it can also be that they are outliers in the residuals and have a big impact on the model fit. (Often outliers "mask" themselves so that they pull the fit to themselves and aren't residual outliers). If masking had occured the first time out fit the model and you eliminated points you may have been eliminating good ones. So indeed, an automatic method is preferred like the one in the link. $\endgroup$ – Deathkill14 Jan 20 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.