3
$\begingroup$

If I have two sequences:

1: A-B-C-D
1: X-A-B-C-D

and I do:

library(TraMineR)
seqdist(sequence1, sequence2, method = "OM")

Will it then compare position 1, 2, 3, 4, 5 (in the 2nd sequence) and show that each position needs to be replaced, or is it smart enough to just insert the X at the front of the 1st sequence, and then shift the other markers so as to make the two sequences equal (aligned)?

$\endgroup$

1 Answer 1

2
$\begingroup$

Yes, this is the whole advantage of optimal matching over Hamming distance. You can check it like this

library(TraMineR) 
myseq <- seqdef(c("a-b-c-d", "x-a-b-c-d"))
seqdist(myseq, method="OM", sm="CONSTANT")

The resulting distance is one, because it only insert x at the front and then shift the rest of the sequence.

If you use

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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