我想应用WeightedCluster
包中可用的功能来分析我通过TraMineR
. 我正在尝试这样做,但由于多通道序列是由每个通道分别组成的列表,我在函数中遇到错误,例如seqtreedisplay()
所有需要sequence object
.
这是一个例子:
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
在多通道类型对象(序列列表)上使用包的功能。我对使用带有初始病房集群(函数)的Partition Around Medioids算法特别感兴趣。wcKMedioids()
如果不可能,哪个是集群多通道的最佳替代方案R
?提前非常感谢!