RM_stoch {RMAT} | R Documentation |
Generate a random stochastic matrix
Description
A (row-)stochastic matrix is a matrix whose rums sum to 1. There is a natural one-to-one corrospondence between stochastic matrices and Markov Chains; this is so when its i,j entry represent the transition probability from state i to state j.
Usage
RM_stoch(N, symm = FALSE, sparsity = FALSE)
Arguments
N |
number of dimensions of the square matrix |
symm |
indicates whether the matrix should be symmetric; equal to its transpose. |
sparsity |
indicates whether the matrix should add some arbitrary sparsity (zeros) |
Value
A random stochastic matrix.
Examples
P <- RM_stoch(N = 3)
P <- RM_stoch(N = 9, sparsity = TRUE)
Q <- RM_stoch(N = 9, symm = TRUE)
Q <- RM_stoch(N = 9, symm = TRUE, sparsity = TRUE)
[Package RMAT version 0.2.0 Index]