rstochmat: Random Generation of Stochastic Matrices
Description
Randomly generates stochastic matrices.
Usage
rstochmat(n, labels)
Value
An \(n\times n\) stochastic matrix with rows and columns labelled according to labels.
Arguments
n
the dimension of the matrix. If n is not specified, it is inferred from the lenth of labels.
labels
a vector of labels for the rows and columns of the matrix. If labels
is not specified, n must be specified and the value
as.character(1:n) is assumed.
Author
Andrew Hart and Servet Martínez
Details
Stochastic matrices are non-negative matrices whose rows all sum to unity. This
function uniformly generates samples from the set of \(n\times n\) stochastic matrices.
At least one of the arguments must be specified. The missing argument is infered from the other.