seqeapplysub {TraMineR} | R Documentation |
Apply every subsequences subseq
to each event sequences seq
and compute the result of the given method
.
seqeapplysub(subseq, seq, method = "count", maxGap = -1, windowSize = -1, ageMin = -1, ageMax = -1, ageMaxEnd = -1)
subseq |
A list of subsequences |
seq |
A list of event sequences |
method |
Type of the result expected, should be one of "count", "presence" or "age" |
maxGap |
The maximum time gap between two group of event. If equal to -1 (default), it won't be considered. |
windowSize |
The maximum window (subsequence) time. If equal to -1 (default), it won't be considered. |
ageMin |
Can be used to set a time period. If equal to -1 (default), it won't be considered. |
ageMax |
Can be used to set a time period. If equal to -1 (default), it won't be considered. |
ageMaxEnd |
Can be used to set a time period. If equal to -1 (default), it won't be considered. |
They are three methods implemented :
It is possible to specify time constraints using maxGap
, windowSize
, ageMin
, ageMax
and ageMaxEnd
. If so, two event should not be separated by more than maxGap
and the whole subsequence should be included in a maximum time of windowSize
.
The other parameters specify the start and end age of the subsequence, it should start between ageMin
and ageMax
and finish before ageMaxEnd
.
The return value is a matrix where every row correspond to a sequence (row names are set accordingly) and each column correspond to a subsequence (col names are set accordingly). The matrix store the results of the count method.
Event sequence analysis module is still experimental
See Also as seqecreate
for more information on how to use event sequence analysis module
#loading data data(actcal.tse) #creating sequences actcal.seqe<-seqecreate(actcal.tse$id,actcal.tse$time,actcal.tse$event) ##printing sequences actcal.seqe[1:10] #Looking for frequent subsequences fsubseq<-seqefsub(actcal.seqe,pMinSupport=0.01) #counting the number of occurence of each subsequence msubcount<-seqeapplysub(fsubseq$subseq,actcal.seqe,method="count") #First lines... msubcount[1:10,1:10] #Presence-absence of each subsequence msubpres<-seqeapplysub(fsubseq$subseq,actcal.seqe,method="presence") #First lines... msubpres[1:10,1:10] #age of first appearance of each subsequence msubage<-seqeapplysub(fsubseq$subseq,actcal.seqe,method="age") #First lines... msubage[1:10,1:10] #counting the number of occurence of each subsequence in summer msubcount<-seqeapplysub(fsubseq$subseq,actcal.seqe,method="count",ageMin=6, ageMax=9, ageMaxEnd=9) msubcount[1:10,1:10]