Markov Chain Chap 9 - 28
HTT Waiting time
> Q <- matrix(data = 0, nrow = 3, ncol = 3) > Q[1, 1] = Q[1, 2] = Q[2, 2] = Q[2, 3] = Q[3, 1] = 0.5 > N <- solve(diag(3) - Q) > C <- c(1, 1, 1) > R <- matrix(data = NA, nrow = 3, ncol = 1) > R[, 1] <- c(0, 0, 0.5) > N1 <- N > NC1 <- N %*% C > NR1 <- N %*% R > N1 [,1] [,2] [,3] [1,] 4 4 2 [2,] 2 4 2 [3,] 2 2 2 > NC1 [,1] [1,] 10 [2,] 8 [3,] 6 > NR1 [,1] [1,] 1 [2,] 1 [3,] 1 |
Waiting time = 10
HHH Waiting time
> Q <- matrix(data = 0, nrow = 3, ncol = 3) > Q[1, 1] = Q[1, 2] = Q[2, 1] = Q[2, 3] = Q[3, 1] = 0.5 > N <- solve(diag(3) - Q) > C <- c(1, 1, 1) > R <- matrix(data = NA, nrow = 3, ncol = 1) > R[, 1] <- c(0, 0, 0.5) > N1 <- N > NC1 <- N %*% C > NR1 <- N %*% R > N1 [,1] [,2] [,3] [1,] 8 4 2 [2,] 6 4 2 [3,] 4 2 2 > NC1 [,1] [1,] 14 [2,] 12 [3,] 8 > NR1 [,1] [1,] 1 [2,] 1 [3,] 1 |
Waiting time = 14