1
$\begingroup$

I have a dataset in which a variety of values are measured at a series of times, and I have some distance function that will calculate dissimilarity between these measured values. For example,

d <- data.frame(t = round(seq(0, pi, length.out = 12), 2))
d$x <- round(sin(d$t), 2)
d$y <- round(d$t * 0.5 + 1, 2)
dissim <- function(x1, x2, y1, y2) {
  sqrt((x1 - x2)^2 + (y1 - y2)^2)
}
d
     t    x    y
1  0.00 0.00 1.00
2  0.29 0.29 1.15
3  0.57 0.54 1.28
4  0.86 0.76 1.43
5  1.14 0.91 1.57
6  1.43 0.99 1.71
7  1.71 0.99 1.86
8  2.00 0.91 2.00
9  2.28 0.76 2.14
10 2.57 0.54 2.29
11 2.86 0.28 2.43
12 3.14 0.00 2.57

I want to group/cluster these observations using the dissimilarity metric, with the caveat that clusters should consist of observations contiguous in time. In this example, if I asked for 4 groups, I'd probably want 1:3, 4:6, 7:9, 10:12.

The application is identifying 4 seasons from weekly measurements of environmental data. I've seen a variety of similar questions, but none have answers.

$\endgroup$
3
$\begingroup$

This paper might be relevant to you: Clustering of Time Series Subsequences is Meaningless - it very convincingly shows that clustering of subsequences does not work. Since separating the year into weeks is a pretty arbitrary construct, I expect that clustering weekly data will not work the way you want it to.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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