Perhaps this is a veru dull question, but I did my research on it and couldn\'t find an answer.
I want to plot my event sequences in the same way we plot sequences o
You are right. The seqplot
family of functions are for state sequences only.
To plot event sequences as state sequences, you have to first transform them into state sequences.
Assuming your event sequences are in the TSE format (vertical time-stamped event form) as the actcal.tse
example file provided by TraMineR
, you can convert them into state sequences using TSE_to_STS
of the companion TraMineRextras
package.
For the transformation , you have to specify in which state you are after each event. You do that by creating a transformation matrix with the seqe2stm
function. Each cell of that matrix should give the new state which results when the column event (column name) occurs while we are in the corresponding row state (row name).
To illustrate, here is the example from the help page of TSE_to_STS
data(actcal.tse)
events <- c("PartTime", "NoActivity", "FullTime", "LowPartTime")
## States defined by last occurred event (forgetting all previous events).
stm <- seqe2stm(events, dropList=list("PartTime"=events[-1],
NoActivity=events[-2], FullTime=events[-3],
LowPartTime=events[-4]))
mysts <- TSE_to_STS(actcal.tse[1:100,], id=1, timestamp=2, event=3,
stm=stm, tmin=1, tmax=12, firstState="None")
Once you have your state sequences in STS form, you can create the state sequence object and plot them.
my.seq <- seqdef(mysts)
seqdplot(my.seq)
Alternatively, you can make a parallel coordinate plot of your event sequence using the seqpcplot
function. There are plenty of example on the help page of that function. For details on the plot refer to
Bürgin, R. & Ritschard, G. (2014), "A decorated parallel coordinate plot for categorical longitudinal data", The American Statistician. Vol. 68(2), pp. 98-103. doi
Hope this helps.