我想應用WeightedCluster
包中可用的功能來分析通過TraMineR
獲得的多通道序列。我想這樣做,但由於多通道序列是由每個通道分開組成的列表,因此我在例如seqtreedisplay()
和所有需要sequence object
的功能中遇到錯誤。通過WeightedCluster包進行多通道序列分析
這是一個例子:
fullsequences <- list(
work_sequence2 = work_sequence[which(rownames(work_sequence) %in% commonid),],
educ_sequence2 = educ_sequence[which(rownames(educ_sequence) %in% commonid),],
part_sequence2 = part_sequence[which(rownames(part_sequence) %in% commonid),],
kid_sequence2 = kid_sequence[which(rownames(kid_sequence) %in% commonid),]
) # a total of 926 with complete sequences on all channels
multidist <- seqdistmc(
channels = fullsequences,
method = "OM",
norm = FALSE,
sm = list("TRATE","TRATE","TRATE","TRATE"),
with.missing=FALSE,
full.matrix=TRUE,
link="sum")
clusterward <- hclust(as.dist(multidist), method = "ward")
seqtreedisplay(as.seqtree(clusterward, ncluster = 5,
seqdata = fullsequences , diss = multidist))
Error in seqlegend(seqdata, fontsize = legend.fontsize, title = "Legend", :
data is not a sequence object, use seqdef function to create one
是否有在多通道型對象(序列列表)的使用WeightedCluster
包的功能的方法。我特別感興趣的是使用初始病房集羣(功能wcKMedioids()
)的算法。如果不可能,這是R
中集羣多通道的最佳選擇嗎? 非常感謝!