I'm working with multiple time-series. Each time series is a record of a value (let's say a price) per month.

In each time-series, I have a reference period (let's say, 9 months, making it 9 records), that I use to characterize the past behaviour of each sample analysed.

My goal is to check if my few next months (for example, 3 months following the reference period) have a same or different behaviour from my reference. Let's call this 3-month period my analysed period.

This includes the following points :

  • If my price doesn't varry much in my 'reference', it's expected not to varry much in 'analysed'. A higly-varrying price in those 3 months would be an anomaly.
  • If in my price varries a lot in my 'reference', a huge price-variation in my 'analysed' is the expected behaviour, and the anomaly would be if this price doesn't varry much.

Is there any known method to decide wether price behaviour in 'analysed' is the same as 'reference' one or not ? I only found methods to detect big variations, but nothing creating a relation with the past behaviour.

Thanks in advance


1 Answer 1


The first method that comes to my mind is K-nearest neighbor. From 9-month reference data, you can create 7 pieces of 3-month data (1-3, 2,4, ... 7-9). You can then calculate the distance between each of them and the analyzed data. You can define the maximum distance as the measurement of deviation from the reference data.

I think what you are trying to do falls in the area of anomaly detection. There are many other ways to compute the distance between the reference and the analyzed, such as singular value decomposition, Euclidean distance, cosine similarity, and so on. You may also simply calculate statistics such as the mean and variance from the reference data and compare them against the analyzed data. This actually is a form of anomaly detection.

  • $\begingroup$ Thanks a lot for your answer $\endgroup$
    – Adept
    Sep 2, 2021 at 11:14
  • $\begingroup$ Comparing mean and variance through statistical tests is already what I've done for another subject, but I felt like I had not enough samples to use such a method here (9 samples in my 'reference' and 3 in my 'analysed') $\endgroup$
    – Adept
    Sep 3, 2021 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.