rmarkov | R Documentation |
Generates a sequence of discrete states from a discrete-time Markov chain with transition matrix P
.
rmarkov(n, P, start = rep(1, ncol(P)))
n |
length of the generated sequence. |
P |
transition matrix (rows are normalized to sum to 1). |
start |
vector with nonnegative values that defines the discrete starting
distribution at t=0 ( |
P <- matrix(c(.30, .50, .20,
.05, .25, .70,
.00, .10, .90), 3, 3, byrow=TRUE)
rmarkov(50, P)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.