# Metric to measure consistency (or randomness) of a group of time-series data

I have hourly time series consumption data of four customers namely (F238, F262, F267, F264) for a complete month, plotted as

Each line represents the consumption on a separate day. I want to find which among these customers is most stable/consistent in terms of repeating patterns across days and which among these is most random. Is there a specific metric which measures the randomness or shape consistency among different days of time-series data?

On visualisation, F238 seems most consistent as compared to others because of consistency in patterns followed across days of a month, while as F262 seems most random because every day seems to follow a different pattern. Is there any metric which can summarise this observation, such that the metric output may vary between fixed pair of values (like [0, 1])?

• The correlation matrix of the signals for a same costumer for different days will give you a "randomness measure" of the time-series. – Eskapp Dec 21 '16 at 16:53
• The correlation matrix gives me the pair-wise correlation between different time-series pairs, but I need a metric which can summarise all time-series in one shot. – Haroon Rashid Dec 21 '16 at 17:58
• You can build a metric from the correlation matrix by taking the mean, the standard deviation or other properties of it. This is only an idea :) – Eskapp Dec 21 '16 at 18:27
• I don't see why this has to be fancy. Average each group of series; then the RMS error over all series in a group measures how consistent each group is. Feel free to use medians etc., to do it on logarithmic scale etc. Regardless of that, it looks as if logarithmic scale is a more natural metric here. – Nick Cox Dec 22 '16 at 16:11

A measure of randomness or predictability for a time series is the MSE or R-Sq from a reasonable model. Comparison of these measures across customer could facilitate groupings and exceptionally different customers. In order to build a good model for daily/hourly data which I am involved with all the time is to incorporate both memory (ARIMA) and deterministic structure (X's) (like days-of-the-week etc. ) for each hour. Please review Forecasting technique for daily data with monthly and day of week seasonality for some pointers on what factors (hidden layers) can be extracted that are statistically significant.

I have posted and you can search for "user:3382 daily data" to obtain other words and examples . If you wish to actually post daily data for two of your customers i will try to take the time to present you with examples of "useful models"

Another thought is to actually compute out-of-sample error measures (MAPE for example) and use that metric to summarize a customer.

• The weak link here is the assumption that predictability in terms of a model of the kind you favour is equivalent to consistency among series for individual customers. I don't see why you assume that unless you are fitting the same model to all the series, which doesn't seem like anything I've ever seen you advocate: on the contrary your modelling philosophy seems to be model each quirky series with an appropriately quirky model. – Nick Cox Dec 22 '16 at 16:08
• You could do that without really customizing ..I just didn't take my thinking down to the fine points. I was speaking quite generally . – IrishStat Dec 22 '16 at 16:32
• in fact there would be nothing wrong in applying a general equation to all as one of the parameters would be a conditional mean and the remainder some memory adjustment structure. Omitting pulse detection could ensure that historical true "randomness /lack of predictability/variability" was being measured for comparative analytics.. Is "quirky" a pejorative expression ? – IrishStat Dec 22 '16 at 16:50
• The word quirky is to me neutral in implication and in context could be positive. An interestingly quirky book is worth a look. A strangely quirky approach is puzzling, but may be valid. It is a little like ad hoc, which often in context is intended to be critical, but I sometimes translate it as "fit for purpose", meaning tailored to and right for the circumstances. – Nick Cox Dec 22 '16 at 17:07
• tu ... here in the colonies where we just use and abuse the language , it is taken as a pejorative reflection but I now am enlightened .. best holiday wishes .. – IrishStat Dec 22 '16 at 17:43

You could compute the similiarity of all time-series within a cluster - the average intra cluster distance using either Euclidean Distance or Dynamic Time Warping Distance. In most cases for Time-Series Analysis, Dynamic Time Warping is recommended, since it is an elastic measure and yields low distance for two series which are out of phase yet very similiar. To evaluate the randomness for each class, you could compute the average distance of a single measurement to all others in the same class. If the distance is high, the class is more mixed/random, whereas if the distance is low, the variation in between samples of the class is low.

YET, you might want to use euclidean distance if not the pattern but the time of the activity that you measured is of interest. Therefore you will chose a metric based on domain knowledge.

For more information I recommend the tutorials of Eamonn Keogh which can be found here. The following picture illustrates the difference betwen Euclidean Distance and Dynamic Time Warping and is taken from a tutorial of Eamonn Keogh.

• Thanks Nikolas for your effort, but this does not answer my question. With this approach, I can never quantify the ideal best (utmost consistent) or the ideal worst (utmost random). I need a metric which can summarise consistency of group of time-series in fixed range of values (like probability where 0 may represent fully random and 1 may represent fully consistent ) – Haroon Rashid Dec 21 '16 at 18:03
• Well if all time-series in a group are exactly equal, then the average distance is zero. And a high distance reflects high randomness / variety. Can you provide a toy example, where the distance approach would yield wrong results ? – Nikolas Rieble Dec 21 '16 at 20:52