Description Usage Arguments Details Value Author(s) Examples
Plots the expected steps for finite state irreducible Markov chain in a heatmap
1 |
pijdef |
The transition probabilities in matrix form. |
type |
Type of Markov chain, either 'discrete' or 'continuous'. |
init |
Set of desired initial states (default to all states). |
dest |
Set of desired destination states (default to all states). |
... |
Additional arguments for continuous Markov chain (see details). |
This function plots the heatmap of the expected steps of a finite state irreducible Markov chain. The user can supply the desired initial states and/or destination states using the arguments init and/or dest respectively. The function will plot the heatmap for the expected steps between states if these arguments are not supplied.
For continuous type markov chain, users must supply either both probability transition matrix (pijdef) and holding rates (qidef), or the transition rate matrix (transrate) itself. See ?expectstep for more details.
A plot of the expected steps for the desired initial and destination states in the form of a heatmap.
Rex Cheung <rccheung@ucdavis.edu>, Teresa Filshtein <teresa.filshtein@gmail.com>, Norm Matloff <matloff@cs.ucdavis.edu>, and Ozan Sonmez <osonmez@ucdavis.edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Discrete Markov chain
P = matrix(rep(0.5, 9), ncol = 3)
P[1,3] = 0; P[2,2] = 0; P[3,1] = 0
plotstep(P, 'discrete')
plotstep(P, 'discrete', init = c(1,3))
plotstep(P, 'discrete', init = c(1,3), dest = c(2,3))
#Continuous Markov chain
#With probability transition matrix and holding rates
qidef = c(0.25, 0.175, 0.08)
pijdef = matrix(c(0, (1/20)/((1/20)+(1/8)), 0, 1, 0, 1, 0, (1/8)/((1/20)+(1/8)), 0), nrow = 3)
plotstep(pijdef, type = 'continuous', init = 1:2, dest = 1:3, qidef = qidef)
#With transition rates
Q = matrix(c(-0.25,0.05,0,0.25,-0.175,0.08,0,0.125,-0.08), nrow = 3)
plotstep(type = 'continuous', init = 1:2, dest = 1:3, transrate = Q)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.