我正在尝试第一次尝试时间序列聚类,需要一些帮助。我读过用于时间序列聚类的tsclust和dtwclust包,并决定尝试dtwclust。
我的数据包括不同地点的温度日时间序列(每天一个值)。我想把空间星系团中的不同位置从它的温度序列中分类。我的第一次尝试已经完成(刚刚复制了一个带有选项的示例,并将我的数据,temp.max3)
library(dtwclust)
hc<- tsclust(temp.max3, type = "h", k = 20L,
preproc = zscore, seed = 899,
distance = "sbd", centroid = shape_extraction,
control = hierarchical_control(method = "average"))但这给了我错误信息
统计错误::hclust(stats::as.dist(距离),方法,成员=点$成员):NA/NaN/Inf在外部函数调用(arg 11)
我之前必须删除任何系列中的所有NA,因此temp.max3数据不包含任何NA值。
summary(temp.max3)
8025 8400A 8416 8455
Min. : 6.40 Min. : 4.60 Min. : 6.00 Min. : 4.00
1st Qu.:18.80 1st Qu.:17.40 1st Qu.:18.20 1st Qu.:19.00
Median :23.20 Median :22.00 Median :22.60 Median :24.00
Mean :23.34 Mean :22.23 Mean :22.71 Mean :23.67
3rd Qu.:28.20 3rd Qu.:27.40 3rd Qu.:27.40 3rd Qu.:29.00
Max. :41.40 Max. :40.60 Max. :43.00 Max. :42.00数据看起来像
head(temp.max3)
8025 8400A 8416 8455
13127 16.0 14.0 13.5 14
13128 17.8 15.6 17.4 20
13129 18.2 15.2 19.2 18
13130 17.2 15.0 17.6 19
13131 17.0 13.8 15.6 17
13132 21.0 14.0 18.2 19其中,8025,8400 A,8416和8455是车站代码(目前只有四个,但最终将扩展到120 )。数据可以在这个dropbox链接https://www.dropbox.com/s/xru4qnz8grhbxuo/data.csv?dl=0上找到。
如果您有任何想法、链接到信息或示例,我们将不胜感激。
发布于 2017-12-14 14:04:09
由于Alexis的注释,错误消息消失了,脚本运行良好。
library(dtwclust)
temp.max4<-t(temp.max3)
hc<- tsclust(temp.max4, type = "h", k = 2L,
preproc = zscore, seed = 899,
distance = "sbd", centroid = shape_extraction,
control = hierarchical_control(method = "average"))用这个输出

亚历克西斯,对不起,我不能接受这个评论作为解决方案。
https://stackoverflow.com/questions/47810174
复制相似问题