I'm using R and the library TraMineR to do sequence analysis on social science data. I have computed an optimal matching (OM) distance matrix.
[,1] [,2] [,3] [,4]
[1,] 0.00000 94.80628 110.00000 107.46826
[2,] 94.80628 0.00000 53.71086 78.02520
[3,] 110.00000 53.71086 0.00000 47.88362
[4,] 107.46826 78.02520 47.88362 0.00000
Here is a dput() of the OM matrix:
structure(c(0, 94.8062777425491, 110, 107.468255963965, 94.8062777425491,
0, 53.7108606841158, 78.0251951544836, 110, 53.7108606841158,
0, 47.8836216007405, 107.468255963965, 78.0251951544836, 47.8836216007405,
0), .Dim = c(4L, 4L))
It is based on this data: https://github.com/aronlindberg/VOSS-Sequencing-Toolkit/blob/master/twitter_exploratory_analysis/cassandra.csv
and I computed it using this code:
# Read and transpose data
twitter_sequences <- read.csv(file = "cassandra.csv", header = TRUE)
twitter_sequences_transposed <- t(twitter_sequences)
# Define the sequence object
twitter.seq <- seqdef(twitter_sequences_transposed, left="DEL", right="DEL", gaps="DEL", missing="")
# Define the substitution matrix
twitter_costs <- seqsubm(twitter.seq, method="TRATE")
# Calculate the OM matrix
twitter.om <- seqdist(twitter.seq, method="OM", indel=1, sm=twitter_costs, with.missing=FALSE)
Now I want to express the similarity between two sequences in %. How can I accomplish this?