# NOT RUN {
# generate a random 5x5 Markov transition matrix
Q = get_random_mk_transition_matrix(Nstates=5, rate_model="ARD")
# calculate stationary probability distribution
p = get_stationary_distribution(Q)
print(p)
# test correctness (p*Q should be 0, apart from rounding errors)
cat(sprintf("max(abs(p*Q)) = %g\n",max(abs(p %*% Q))))
# }
Run the code above in your browser using DataLab