Hi, see inline ________________________________________ Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmazó: Armel KAPTUE [armel.kap...@sdstate.edu] Küldve: 2014. január 28. 8:16 To: R-help@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: http://stackoverflow.com/questions/2754469/r-library-for-discrete-markov-chain-simulation Best daniel Thanks, -- Armel [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.