rcfmc {smfsb} | R Documentation |
Simulate a continuous time finite state space Markov chain
Description
This function simulates a single realisation from a continuous time Markov chain having a finite state space based on a given transition rate matrix.
Usage
rcfmc(n,Q,pi0)
Arguments
n |
The number of states to be sampled from the Markov chain, including the initial state, which will be sampled using |
Q |
The transition rate matrix of the Markov chain, where each off-diagonal element |
pi0 |
A vector representing the probability distribution of the
initial state of the Markov chain. If this vector is of length |
Value
An R stepfun
object containing the sampled path of the process.
See Also
Examples
plot(rcfmc(20,matrix(c(-0.5,0.5,1,-1),ncol=2,byrow=TRUE),c(1,0)))