Outlier detection of time series data in R

growth_hacker picture growth_hacker · Jul 15, 2014 · Viewed 15.7k times · Source

What are the steps needed to detect outliers in business sales data (which means there might be trends and seasonality) in R?

I have learnt about ACF, PACF, residual, ARIMA model (basically, time series analysis and modelling). Can I use this knowledge to help me identify outliers?

Is it also possible to ask R to pinpoint which point of data is outlier?

Thank you very much.

Answer

javlacalle picture javlacalle · Jul 15, 2014

You may have a look at the following packages available in R.

The R package forecast uses loess decomposition of time series to identify and replace outliers.

The R package tsoutliers implements the Chen and Liu procedure for detection of outliers in time series. A description of the procedure and the implementation is given in the documentation attached to the package. You may also see this post.