我使用TraMineR包中的函数seqdist。
首先,我在seq.all中计算了两个轨迹:
seqdist(seq.all[1:2,], method="OM", indel=1.1, sm=couts)
[,1] [,2]
[1,] 0.00000 46.91843
[2,] 46.91843 0.00000所以这些轨迹之间的距离似乎是46.91843。
但是当我使用参数refseq时:
seqdist(seq.all[1,], method="OM", indel=1.1, sm=couts,refseq = seq.all[2,])
[1] 60.32636现在,这些轨迹之间的距离似乎是60.32636。
诀窍是什么?
发布于 2018-11-13 01:00:15
通过将序列的索引作为refseq参数传递,可以获得所有序列到所考虑的序列对象的其中一个序列的距离。因此,您可以使用以下命令获得两个序列之间的距离
seqdist(seq.all, method="OM", sm=couts, indel=1.1, refseq=2)[1]不过,您的代码也应该可以工作,并且应该提供相同的值。
https://stackoverflow.com/questions/53261577
复制相似问题