Outliers spotting in time series analysis, should I pre-process data or not? My question builds on a previous post on outlier detection in generic time series, and specifically on the answer provided by the always great Rob H.
I work for a small-sized manufacturing company that currently handles the issue, i.e. detecting outliers in sales data time series, employing a (dubious) automated off-the-shelf software procedure. 
I think this kind of approach is questionable at best and, more often than not, I'm not happy with the results I get. I would therefore like to "double check" the output from our software using some alternative method.
Rob's idea seemed reasonable, straightforward and easy to implement, so I decided to give it a try. Question is: what if my time series are not "generic"?
Stl decomposition highlights a strong seasonality and a varying trend in my data:

(BTW I used stl(x,s.window="periodic") like Rob suggested, but IMHO stl(x,s.window="periodic",robust=TRUE) would be a better choice since outlier detection is the issue at hand here. Also I'm not really sure about the s.window="periodic" part, I tried experimenting with different values a bit, but I don't know how to interpret results. Maybe someone can point me in the right direction?).
Back to my question, mine being sales data, the seasonal pattern is (or I think it is) strongly affected by calendar effects. Also I have reason to believe the big level shift in 2009 is due to the financial crisis and it has nothing to do with trend.
What do I do here? Should I let the model handle this, or should I pre-process data? Do I perform working-day adjustment and re-allign (is there such a thing?) before-2009 and after-2009 data, or do I let STL decomposition do the work?
I could write another 1000 lines, but I think this should be enough to get the message through. I apologize for the WOT and for my bad english. Also I hope I did not break too many forum rules...
I hope someone out there can help!
 A: *

*The smooth trend should cope with economic effects without any trouble. 

*Using robust=TRUE in stl makes sense here (and I've changed my original function to do the same).

*Unless you have more than ten years of data, I would stick with periodic seasonality. It is unlikely to change fast enough to detect with shorter time series.

*Pre-processing the data for working days makes sense as it removes known causes of variability.


I suggest you try the stl approach and look at where it gives very different results from your existing method. Then look at those cases and see which method is giving the most sensible results.
I would not go the ARIMA route as it is nowhere near as robust as stl.
A: Ok now, let's try this for comparison. What if I remove calendar effects by dividing the original time serie by the number of actual working days in each month and then I multyply the results by 21?
The original time-serie is in black, and the calendar-adjusted one is in red:

The first thing that popped into my mind is: hey, are these data really seasonal? August might be, but what about November/December? It seems to me that working-day adjustment cancels out most, if not all, of the seasonality for the winter months. How do you guys see it?
On top of that: I still notice the pulse in Nov'05 and Jan'09, I'm not really sure about May'06 and it seems to me like Jan'08 might have been more of a matter related to working days than to an actual pulse.
Also, I can totally see the level shift in Feb'09, but what about the one in Dec'06? Isn't it more like a side-effect of the Nov'06 pulse (is Nov'06 even a pulse considering calendar-adjusted data)? The serie went up so high that, when it came back down, it seemed like a shift in level. Does the pulse-adjusted data still generate a level shift warning in Dec'06?
Again, the idea here is to try and see if pre-processing of data might actually improve correct outlier identification. I think a side-by-side test like this might help. IrishStats (or anyone else) care to accept the challenge? :-)
A: The problem/opportunity is to identify the underlying ARIMA or Seasonal Dummy Model and augment as needed . This particular series evidences string / dominant determinstic seasona dummies as compared to a seasonal ARIMA structure. We then identify both unusual values be they pulses, seasonal pulses, level shifts and or local time trends AND and autoregressive structure needed to generate "noise". Two Level Shifts were identified on or around time period 50 (2009/February) and period 24 (2006/December). The data suggested the following model  . The unusual values i.e. the PULSES  are listed here. A very illuminating graphic is the cleansed vs the actual shown here . Finally the fit/actual/forecast graph is a good ( but busy ) summary . The forecast graph is  . The final model statistics are shown in the last three images      and   and  and  . The residuals from the model are reasonably random  with no remaining autocorrelative structure . Hope this little example helps all ! I am one of the developers of the software I used here . There are other commercially available products that will deliver something similar.
