# Create a 3x3 ergodic PPM
A <- matrix(c(0,0,2,0.5,0.1,0,0,0.6,0.6), byrow=TRUE, ncol=3)
A
# Diagnose ergodicity
is.matrix_ergodic(A)
# Create a 3x3 nonergodic PPM
B<-A
B[3,2] <- 0
B
# Diagnose ergodicity and return
# left eigenvector
is.matrix_ergodic(B, return.eigvec=TRUE)
Run the code above in your browser using DataLab