Is there a way to generate the transition matrix for all the sequences (ie the id) in a dataset ?
In my case, my data is in TSE format, so I use some functions of the TraMineRextras package.
My intention is to loop over each sequence, but when I want to compute transition rates for a given id, I get the following error after executing TSE_to_STS() function :
Error in 'rownames'<-('tmp', value = "1") : attempt to set 'rownames' on an object with no dimensions
It looks like a minimum of two sequences is expected in argument of TSE_to_STS().
test.events <- c("A","B","C")
test.stm <- seqe2stm(test.events, dropList=list("A"=test.events[-1], B=test.events[-2], C=test.events[-3]))
test.tse <- data.frame(id = c(1,1,1), time = c(1,2,3), event = c("A","B","C"))
test.sts <- TSE_to_STS(test.tse, id = "id", timestamp = "time", event = "event", stm=test.stm, tmin=1, tmax=4, firstState="None")
test.seqdef <- seqdef(test.sts,informat = "STS")
seqtrate(test.seqdef)