2
votes

I wonder if seqici() depends on the context? I have a sequence and I compute the complexity seqici(mySeq). I have the same sequence in a set of sequences, and I compute the complexity and have different values. Can some one help to know what happens?

Thanks,

2

2 Answers

3
votes

I think I got. Yes the complexity depends on the "context". When you put all sequences together, seqici() use the "common" alphabet to compute the complexity. So if there is no element of the alphabet in a sequence, the complexity of that sequence will change when it's computed alone vs. computed in the set of sequences. As illustration,

d1 <- data.frame(s1 = c("A", "B", "A", "C", "B", "A"))
d2 <- data.frame(s2= c("A", "C", "B", "B", "D"))
d1 <- zoo(d1)
d2 <- zoo(d2)
nm <- list("d1", "d2")

d <- zoo()
for(i in 1:length(nm)) 
  d <- merge(d, get(nm[[i]]))

d <- t(d)
seq <- seqdef(d)
seqici(seq)

//s1 0.8541510
//s2 0.8489541

d1 <- t(d1)
d2 <- t(d2)
seq1 <- seqdef(d1)
seq2 <- seqdef(d2)
seqici(seq1)
//s1 0.9594894
seqici(seq2)
//s2 0.8489541

The difference in results is because "D" is in d2 and not in d1.

Hope this can help others :-)

1
votes

Gabadinho's complexity index depends on the overall possible states (the alphabet) of your sequence. This is by definition. Here is an example based on your own one:

myseq <- t(data.frame(s1 = c("A", "B", "A", "C", "B", "A")))

seq1a <- seqdef(myseq, alphabet = c("A","B","C"))
seqici(seq1a) # 0.9594894

seq1b <- seqdef(myseq, alphabet = c("A","B","C","D"))
seqici(seq1b) # 0.854151

If you don't specify the alphabet when creating sequence data, TraMineR will use the different states existing in your data for setting it. So, according to your input data the alphabet may differ, and then you may obtain different results for measures depending on the alphabet.

To avoid confusion it is a good rule to always define explicitly the alphabet in which your sequences are embedded.