I have a situation that is reasonably well-modelled by a discrete Hidden Markov Model (HMM), but with one twist: when you enter a state, the amount of time that you spend there is given by some distribution/random process that isn't necessarily stateless.
Assume that for each state $q_i$, we have a discrete probability distribution $p_i(t)$, where $p_i(t)$ is the probability that you spend the next $t$ time steps at $q_i$ and then leave $q_i$ in the $t+1$th time step. When you leave $q_i$, you pick one of the transitions out of $q_i$, according to the probabilities on the transitions, just as is standard for a Markov process. As always in a HMM, the distribution on the output depends on what state you're currently in.
This is a slight generalization of a standard HMM. If each probability distribution $p_i(\cdot)$ is memoryless (i.e., a geometric distribution), then it's equivalent to a standard HMM. So, let's call it a G-HMM.
Has this kind of model been studied? Given a set of output sequences, is there a way to learn a G-HMM that best explains those sequences, i.e., maximum-likelihood estimation of the parameters (akin to Baum-Welch)? (You can assume the shape of the $p_i(\cdot)$ distributions are known and only their parameters are unknown.)