I have a sequence of behavioural states (for a single moving animal), each with an associated duration, and am interested in producing a synthetic state sequence that preserves the properties of the original (particularly, the state-change probabilities, and the dwell-time distributions).
However, preliminary investigations of the dwell-time distributions indicate they are not geometrically distributed, so I think I should fit a semi-Markov model.
The R package, 'SemiMarkov' provides the below reproducible example of how to fit a semi-Markov model to an observed sequence of state-changes. However, I cannot see how to then produce a synthetic sequence of state-changes from the fitted object - here, 'fit1'.
library(SemiMarkov)
data(asthma)
## Definition of the model: states, names, possible transtions and waiting time distributions
states_1 <- c("1","2","3")
mtrans_1 <- matrix(FALSE, nrow = 3, ncol = 3)
mtrans_1[1, 2:3] <- c("E","E")
mtrans_1[2, c(1,3)] <- c("E","E")
mtrans_1[3, c(1,2)] <- c("E","E")
## semi-Markov model
fit1 <- semiMarkov(data = asthma, states = states_1, mtrans = mtrans_1)
print(fit1)
FWIW, it is possible to fit a state-change sequence to a regular markov model (using 'markovchainFit' in the package 'markovchain'), and then simulate a synthetic state-change sequence (using 'rmarkovchain'), but there seems to be no obvious way of doing the same for a semi-Markov model.