Comments: Firstly I would like to say a big thank you to the author of the new tsoutliers package which implements Chen and Liu's time series outlier detection which was published in the Journal of the American Statistical Association in 1993 in Open Source software $R$.
The package detects 5 different types of outliers iteratively in time series data:
- Additive Outlier (AO)
- Innovation Outlier (IO)
- Level Shift (LS)
- Temporary change (TC)
- Seasonal Level Shift (SLS)
What is even more great is that this package implements auto.arima from forecast package so detecting outliers is seamless. Also the package produces nice plots for better understanding of the time series data.
Below are my questions:
I tried running few examples using this package and it worked great. Additive outliers and level shift are intuitive. However, I had 2 questions with regards to handing Temporary Change outlier and Innovational outliers which I'm unable to understand.
Temporary Change Outlier Example:
Consider the following example:
library(tsoutliers)
library(expsmooth)
library(fma)
outlier.chicken <- tsoutliers::tso(chicken,types = c("AO","LS","TC"),maxit.iloop=10)
outlier.chicken
plot(outlier.chicken)
The program rightly detects a level shift and a temporary change at the following location.
Outliers:
type ind time coefhat tstat
1 LS 12 1935 37.14 3.153
2 TC 20 1943 36.38 3.350
Below is the plot and my questions.
- How to write the temporary change in an equation format ? (Level shift can be easily written as a binary variable, anytime before 1935/Obs 12 is 0 and any time after 1935 and after is 1.)
The equation for temporary change in the package manual and the article is given as :
$$ L(B) = \frac{1} {1-\delta B} $$
where $\delta$ is 0.7. I'm just strugling to translate this to the example above.
- My second question is about innovational outlier, I have never come
across an innovational outlier in practice. any numercial example or a case example would be very helpful.
Edit: @Irishstat, the tsoutliers function does an excellent job in identifying outliers and suggesting an appropriate ARIMA model. Looking at the Nile dataset, see below application of auto.arima and then applying tsoutliers (with defaults which includes auto.arima):
auto.arima(Nile)
Series: Nile
ARIMA(1,1,1)
Coefficients:
ar1 ma1
0.2544 -0.8741
s.e. 0.1194 0.0605
sigma^2 estimated as 19769: log likelihood=-630.63
AIC=1267.25 AICc=1267.51 BIC=1275.04
After applying tsoutliers function, it identifies an LS outlier and additive outlier and recommends an ARIMA order (0,0,0).
nile.outliers <- tso(Nile,types = c("AO","LS","TC"))
nile.outliers
Series: Nile
ARIMA(0,0,0) with non-zero mean
Coefficients:
intercept LS29 AO43
1097.7500 -242.2289 -399.5211
s.e. 22.6783 26.7793 120.8446
sigma^2 estimated as 14401: log likelihood=-620.65
AIC=1249.29 AICc=1249.71 BIC=1259.71
Outliers:
type ind time coefhat tstat
1 LS 29 1899 -242.2 -9.045
2 AO 43 1913 -399.5 -3.306
tsoutliers
has been renamed astso
to avoid conflict with a function of the same name in packageforecast
. $\endgroup$clang
andgcc
and neither works. I think it is an awesome package but the installation really broke my heart. $\endgroup$