Skip to contents

This helper function generates a transition matrix at random for testing purposes

Usage

generate_random_T(n = 3)

Arguments

n

(integer) dimension of a transition matrix

Value

random n x n transition matrix

Details

Uniform random numbers \([0,1]\) are used to fill the matrix. Rows are then normalized.

Examples

mat_T <- generate_random_T(3)
mat_T
#>           [,1]      [,2]      [,3]
#> [1,] 0.4696583 0.5303417 0.0000000
#> [2,] 0.3376557 0.3347981 0.3275462
#> [3,] 0.0000000 0.4288436 0.5711564

rowSums(mat_T)
#> [1] 1 1 1