[RsR] Outliers and ARMA?

Ajay Shah @j@y@h@h @end|ng |rom m@y|n@org
Tue Oct 29 09:26:36 CET 2013


When I use TSA::detectIO() and TSA::detectAO() I find that my data has a
few outliers. What should one do next?

Here's a self-contained example:

pi <- c(9.11, 4.53, 20.17, 13.26, 15.29, 12.95, 14.93, 12.65, -4.2,
-4.22, 8.42, 10.44, 8.29, 14.37, 20.24, 17.93, 11.8, 17.49, 3.85,
9.58, -9.58, 0, 9.58, 7.61, 7.56, 20.55, 23.84, 26.93, 7.08, 8.79,
6.99, 6.95, -13.93, -8.79, 5.28, 10.5, 19.01, 13.64, 18.5, 21.5,
14.66, 3.23, 6.44, 11.19, 3.18, 0, 0, 3.17, 11.03, -7.87, 11, 9.35,
3.1, 7.72, 12.25, 4.56, 19.56, 36.75, -5.8, -5.83, 8.74, 18.72, 31.02,
35.66, 5.39, 20.01, 36.48, 14.04, -24.35, -26.17, -14.64, -2.68, 2.68,
11.99, 2.65, 11.85, 5.23, 9.1, 21.81, 2.54, -19.18, 0, -2.58, 10.29,
11.47, 5.06, 6.3, 7.52, -5.01, 2.51, 13.69, 2.47, -11.16, -2.49,
-5.01, 5.01, 8.71, 7.42, 15.91, 15.7, 8.37, -3.58, 8.34, 9.46, -7.09,
-4.75, -2.38, 4.76, 2.37, 7.09, 10.55, 12.77, 6.91, 3.44, 4.57, 4.55,
-12.57, -2.3, 2.3, 8.01, 14.74, 2.25, 6.73, 10.02, -4.44, 0, 8.87,
3.31, -5.52, 5.52, 0, 0, 0, 8.78, 9.8, 11.88, 10.7, 3.19, 6.35, -2.11,
-9.56, 11.68, -2.11, 0, 9.49, -5.26, 5.26, 19.78, 4.12, 5.13, 13.25,
10.09, -6.05, 2.02, 0, 0, 10.04, 9.96, 19.67, 9.72, 0, 9.64, 19.05, 0,
0, 0, 9.41, -9.41, 9.41, 9.34, 9.27, 18.32, 9.06, 0, 8.99, 0, 0, 0,
8.92, 17.65, 8.73, 8.66, 8.6, 25.44, 16.67, 8.25, 16.33, 0, -8.14,
8.14, 0, 0, 16.11, 7.97, 15.79, 53.68, 14.91, 7.38, 14.63, 21.62,
7.12, 21.11, -14.04, 0, 0, 14.04, 13.87, 27.27, 0, 6.72, 13.33, 6.61,
19.62, 19.3, -19.3, 0, 6.47, 6.43, 12.77, 25.13, 6.2, 18.41, 6.08,
6.05, -12.12, 6.08, 6.05, 12, 23.65, 5.84, 11.59, 22.86, 11.27, 5.59,
11.11, 5.52, 5.49, 10.91, 10.81, 5.37, 10.67, 10.57, 15.69, 20.6,
10.17)
timeaxis <- seq(from=as.yearmon("Apr 1993"), to=as.yearmon("Aug 2013"),
by=1/12)

m <- arima(pi, order=c(1,0,0), seasonal=list(order=c(1,0,0), period=12))
errors <- resid(m)
boxplot(errors)                         # There are a few outliers

library(TSA)
weird <- unique(sort(c(detectIO(m)$ind, detectAO(m)$ind)))
par(mai=c(.4, .8, .2, .2))
plot(timeaxis, pi, type="l", col="blue", xlab="", ylab="Per cent");
abline(h=0)
points(timeaxis[weird], pi[weird], col="red", cex=2)

Any suggestions would be most appreciated. :)

-- 
Ajay Shah
ajayshah using mayin.org
http://www.mayin.org/ajayshah
http://ajayshahblog.blogspot.com

	[[alternative HTML version deleted]]




More information about the R-SIG-Robust mailing list