No, the function seqistatd
does return the time in each state for each individual sequence. It is easy however to compute the mean time and variance by groups with the apply
function. I illustrate below with an example using the biofam
data provided by TraMineR
.
library(TraMineR)
data(biofam)
bf.seq <- seqdef(biofam[,10:25])
bf.ldist <- seqistatd(bf.seq)
sel <- (biofam$sex == "man")
## Mean and variance of time in each state for men
(meant <- apply(bf.ldist[sel,], 2, mean, na.rm=TRUE))
(vart <- apply(bf.ldist[sel,], 2, var, na.rm=TRUE))
## and for women
(meant <- apply(bf.ldist[!sel,], 2, mean, na.rm=TRUE))
(vart <- apply(bf.ldist[!sel,], 2, var, na.rm=TRUE))