Description Usage Arguments Details Value References See Also Examples
View source: R/CMCSimulation.R
This function simulates a continuous time finite state space Markov chain with known rate matrix Q, state space 0,1,..,n and initial state i for the time period (0,T). If plotflag is TRUE it also produces a plot.
1 | CMCSimulation(Q,i,Tend,plotflag = FALSE)
|
Q |
the rate matrix. |
i |
the initial state. |
Tend |
the end of the simulation period (0,T). |
plotflag |
flag indicating if plot needed |
We assume that Q is well defined rate matrix.
Returns the matrix (statehist,timehist) containing the realisation of the chain for the specified period. The function also produces a plot of the realisation. \
Jones, O.D., R. Maillardet, and A.P. Robinson. 2009. An Introduction to Scientific Programming and Simulation, Using R. Chapman And Hall/CRC.
1 2 3 |
Loading required package: MASS
Loading required package: lattice
statehist timehist
[1,] 0 0.00000000
[2,] 1 0.01925483
[3,] 0 0.10298757
[4,] 1 0.13101065
[5,] 2 0.20935417
[6,] 1 0.46929502
[7,] 2 0.49303913
[8,] 1 1.37849828
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.