Sunday 23 November 2014

Time series as a point in space

We usually like to predict or study the behaviour of variables through the time. Temperature, exchange rate, electricity usage, visitors of a website, traffic usage of the Internet and many more things can be studied during a period of time. For example the average temperature of a city can be studied during each month of a year, the number of the visitors of a site can be studied during each hour of a day ... and here by the study, we mean finding a reference pattern or baseline of how these variables change during their one cycle.

 12 months average (R) and single year (X) temperature of a city.
Now look at the picture, the blue line (R) shows the average temperature of one of the cities in Canada during 1997-2012 and the green line (X) shows the temperature of that city in 2013. Suppose we want to find out if the year 2013 is an anomaly or not.

The picture shows clearly that we have had a colder winter in 2013 (X) but still we can't say if this is an anomaly or not, because we need to have a margin of tolerance, which may be different in each month, if X tolerate in the margin then it is normal behaviour.

But now let us look at this time series in another way. Why not consider R or X each as a vector in a 12-dimension euclidean space? Exactly like what we talked about in the previous post. If we think this way, we can find the distance between points R and X (which is the length of the R-X) with the formula we talked about before in the previous post. Now if the distance is acceptable the point X is not anomaly otherwise, it is.