Description Usage Arguments Value Examples
Creates a Markov chain object with class "mchain"
. It does not simulate data.
1 |
x |
is a vector of length n containing the observed process, else it is specified as |
Pi |
is the m*m transition probability matrix of the Markov chain. |
delta |
is the marginal probability distribution of the m state Markov chain at the first time point. |
nonstat |
is logical, |
A list
object with class "mchain"
, containing the above arguments as named components.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Pi <- matrix(c(0.8, 0.2,
0.3, 0.7),
byrow=TRUE, nrow=2)
# Create a Markov chain object with no data (NULL)
x <- mchain(NULL, Pi, c(0,1))
# Simulate some data
x <- simulate(x, nsim=2000)
# estimate transition probabilities
estPi <- table(x$mc[-length(x$mc)], x$mc[-1])
rowtotal <- estPi %*% matrix(1, nrow=nrow(Pi), ncol=1)
estPi <- diag(as.vector(1/rowtotal)) %*% estPi
print(estPi)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.