使用 R 模拟马尔可夫链

Simulate Markov Chain using R

用转移矩阵模拟马尔可夫链

#transition matrix
 P = matrix(c(.4, .3, .5, 0, .5, 0, 0, .3, .4), nrow = 3, ncol = 5,
               byrow = TRUE)

我不清楚你到底在找什么。如果你试图在 10100 次后获取转换矩阵,你可以通过 Reduce 跟踪进化进度,其中选项 accumulate 应设置为 TRUE

P10 <- Reduce(`%*%`,replicate(10,P,simplify = FALSE),accumulate = TRUE)
P100 <- Reduce(`%*%`,replicate(100,P,simplify = FALSE),accumulate = TRUE)