Possible Duplicate:
Simple algorithm for online outlier detection of a generic time series

I've got data on quantities sold and average price, by date, for a number of commodities and a number of outlets. Because of the provenance of the data, some of the observations are wrong. I'd like to be able to flag the potential anomalies so that they can be checked.

I've done some context-independent analysis (looking for values outside specified bounds), but I'd like to try some context-dependent analysis - for example, price for a particular commodity out of line by looking across outlets for a single date, or quantity out of line by looking across dates for a single outlet.

For the latter, I'm thinking that some sort of moving window would be the thing to use - I'm pretty sure that for some commodities there are both long term trends and seasonal variation going on, so what I'm looking for is spikes.

My current thoughts are something along the lines of: for each observation, flag it if it's more than some distance from the mean or median of the comparator observations, where the comparator observations would be either those for the same commodity and outlet in a time window, or those for the same date and commodity for all (other) outlets.

Is this anything like any standard technique? If so, what's its name, and what drawbacks does it have? (Once I've got a name I'll be able to search for more descriptions, and hopefully an R implementation).

Thanks for any pointers.


marked as duplicate by whuber Sep 5 '12 at 22:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I'm interested in this too - I've done a few techniques on this problem, but I'm guessing there are "standard" techniques for anomaly detection on time series. $\endgroup$ – Ken Williams Sep 5 '12 at 19:05

Browse other questions tagged or ask your own question.