[R] Markov chain simulation

Kehl Dániel kehld at ktk.pte.hu
Tue Jan 28 15:00:10 CET 2014

Hi, see inline
Feladó: r-help-bounces at r-project.org [r-help-bounces at r-project.org] ; meghatalmazó: Armel KAPTUE [armel.kaptue at sdstate.edu]
Küldve: 2014. január 28. 8:16
To: R-help at r-project.org
Tárgy: [R] Markov chain simulation

Hi there,

I'm wonder if in R there is a way to simulate a discrete Markov chains with
a specific number of occurence of state knowing the transition matrixway.

Indeed there are many ways to do that in R!

For example, how to simualte a markov chain of length n with p occurences
(p<n) of the sate '0' for a transition matrix defined by:

I am not sure what you mean here?! If you give the length of the chain, depending on the transition matrix you are going to get some occurences of state '0', I do not think you can specify n, p and the transition matrix all at once!

TransitionMatrix<- matrix(c(0.7, 0.3, 0.4, 0.6),byrow=TRUE, nrow=2)

colnames(TransitionMatrix) <- c('0','1')
row.names(TransitionMatrix) <- c('0','1')

Please try googling first, there are a lot of good examples on your problem, among the first ones:




        [[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list