How do you use the time varying substitution cost (time.varying = T) created with the seqcost function in TraMineR? It does not seem to work.
library(TraMineR)
data(biofam)
biofam.seq <- seqdef(biofam[501:600,10:25])
lifcost <- seqcost(biofam.seq, method="INDELSLOG", time.varying = T)
lifcost
biofam.om <- seqdist(biofam.seq, method="OM", indel=lifcost$indel, sm=lifcost$sm)
I get the message
Error: 'indel' has an unknown value
Your computation of time-varying costs is correct. However, OM does not support time-varying costs. The only distance that can use time-varying costs is DHD (dynamic Hamming distance). Distance using indels allow for time warp when aligning sequences and this brings arbitrariness because we would not get the same cost for substituting two states after an insert in one sequence than after a delete in the other sequence.
Here is how you can use time-varying costs:
Alternatively, you get the same results with
Note that although
indelis not used, you cannot assign to it the valuelifcost$indelreturned byseqcostbecause it is a matrix, which is not a supported indel type.