# Find outliers in time-series data

I want to find outliers in power consumption in real-time, at hourly rate, i.e., at the end of the hour, I should say whether power consumption in current hour was outlier/anomalous or not.

Approach: Till now, I am done with following steps

1. Say I want to find whether power usage between 9 AM to 10 AM was anomalous? For this, I first find the usage of past n days during the same time interval, then I find the mean/median of all the previous usages
2. Now, I have usage of the current day and the mean/median usage of previous n days. Which statistical measure should I use to declare whether current day usage was anomalous or not?

Using above approach, for 24 hours of a specific (test) day and using past 10 days consumption, I have obtained results as:

Figure interpretation: Black line represents usage of current hour of current day; red and blue lines represent mean and median of past 10 days for same time interval

From the visual inspection, I can say that the usage between 07:10 - 08:00 and between 22:10 - 23:00 is anomalous as there is big difference between actual and previous mean/median usage. I don't know which statistical measure should I use to point out such anomalous instances automatically, using the discussed approach.

• Look up seasonality correction and change detection in time series. There are plenty of books on this matter. May 28, 2016 at 21:22
• I'd say all those are anomalous except 10:30-12:00 and 21:00-22:00? May 29, 2016 at 15:51
• You have included the mean and median as reference values, but not the standard deviation. Yet standard deviation is a key component of outlier detection. Are you able to obtain the standard deviation or not? Jun 2, 2016 at 23:43