4
$\begingroup$

In TraMineR the function seqient() for calculating the entropy of a sequence object is not available for event sequences (as defined with seqecreate()). Does this mean that measures of "variation" does not make logical sense for event sequences? Are there alternatives to measures such as entropy, complexity, and turbulence for event sequences?

A workaround would naturally be to use the TSE_to_STS() function in TraMineRextras to convert the event sequence to an STS sequence object, after which functions such as seqient() becomes available. However, would the statistics coming out of this be reliable?

$\endgroup$

2 Answers 2

4
$\begingroup$

The entropy of a sequence measures the diversity of the elements in the sequence. It is computed from the frequencies of each element of the alphabet in the sequence.

For state sequences, these frequencies give the total time spent in each state belonging to the alphabet.

For event sequences, you can consider the frequencies of the events and the entropy would then give the diversity of the events in the sequence.

I illustrate here how you could compute the entropy of the events occurring in each sequence, using the actcal.tse data provided by TraMineR.

library(TraMineR)
data(actcal.tse)
seqe <- seqecreate(actcal.tse)

## first we take out parentheses and time information 
## from the character representation of event sequences
tmp <- as.character(seqe)
open <- "("
close <- ")"
tmp <- gsub(open, replacement="", x=tmp, fixed=TRUE)
tmp <- gsub(close, replacement="", x=tmp, fixed=TRUE)
tmp <- gsub("-[1234567890]+-", replacement=",", x=tmp, fixed=FALSE)

## Make a state sequence object from the lists of events 
tmp <- gsub(",", replacement="-", x=tmp, fixed=FALSE)
seq.tmp <- seqdef(tmp, sep=",")

## We get the longitudinal event distributions with
head(seqistatd(seq.tmp))

## and the entropy of those distributions as
head(seqient(seq.tmp))

Alternatively you could be interested in the variance of time between the successive events. You would have to extract the time information from the time stamped event sequences not forgetting the null time between simultaneous events.

The complexity index and the turbulence as computed by TraMineR combine information on the sequencing and on duration or spell lengths, and are, therefore, specifically designed for state sequences. The number of transitions and of events in each sequence as suggested by Matthias are relevant longitudinal characteristics of event sequences.

$\endgroup$
2
$\begingroup$

I think that such measure would make sense, depending on what do want to measure exactly. Perhaps, you could be a little more precise about the context of your study.

Anyway, if you want to measure the turbulence, you can count the number of transitions and/or the number of events in the sequences (part of the complexity index is computed from the number of transition, for instance). However, such approach would not consider the timing.

Here is an example. First build some event sequences:

library(TraMineR)
data(actcal.tse)
seqe <- seqecreate(actcal.tse)

Now compute the number of event per sequence and the number of transitions. This relies on the character representation of event sequence (for this reason, your event should not contain the "-" or the "," character).

ntrans <- sapply(strsplit(as.character(seqe), 
    "-"), length)
nevent <- ntrans - 1 + sapply(strsplit(as.character(seqe), 
    ","), length)
## Represent on a scatter plot
smoothScatter(ntrans, nevent)

Regarding transforming the data to TSE. I think that the question is: is the state sequence obtained with TSE_to_STS suitable to study what you want to study? If yes, then it makes sense.

Hope this helps.

$\endgroup$

Your Answer

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

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