Univariate outlier detection

Just to say that I tried using detectAO() as suggested above and it didn't find anything with my data (which looked somewhat similar: short spikes coming off a continuous trend). After googling around, I found that the Hempel filter (function hempel() from package pracma) could do what I needed. I thought I'd add this here in case someone else is looking for a solution.


library(TSA)
ar = TSA::arima(y, c(1,0,0))
detectAO(ar)

shows exactly these 3 points (ind is indices of possible outliers):

> detectAO(ar)
            [,1]      [,2]      [,3]
ind     6.000000 20.000000 31.000000
lambda2 4.739695  5.957604  5.490739

But be careful to apply this approach to any kind of data.