Skip to contents

Sample uniformly and independently from d_k simplices

Usage

runif_dk_vects(d_k, nsamp)

Arguments

d_k

vector of vector lengths

nsamp

number of samples to take

Value

A matrix with sum(d_k) columns and nsamp rows

Examples

runif_dk_vects(c(3, 4, 2), 10)
#>             [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
#>  [1,] 0.08186903 0.31612001 0.60201096 0.30807952 0.07501580 0.45957015
#>  [2,] 0.14241759 0.59157967 0.26600274 0.10423003 0.30270546 0.57435595
#>  [3,] 0.75197552 0.10489829 0.14312619 0.15955906 0.21474925 0.02190114
#>  [4,] 0.26116626 0.72664541 0.01218833 0.08901938 0.08941726 0.79480076
#>  [5,] 0.03272872 0.42254970 0.54472157 0.01434301 0.74399737 0.24041386
#>  [6,] 0.46456797 0.25392395 0.28150808 0.35334638 0.48851445 0.15295913
#>  [7,] 0.25649604 0.23304452 0.51045944 0.38456020 0.24669553 0.12331966
#>  [8,] 0.12742798 0.22785739 0.64471464 0.03126270 0.47318230 0.12029927
#>  [9,] 0.75218639 0.01577287 0.23204074 0.28655484 0.03343276 0.56455726
#> [10,] 0.19991321 0.36293047 0.43715632 0.12874854 0.66426438 0.02725402
#>              [,7]      [,8]        [,9]
#>  [1,] 0.157334532 0.2400753 0.759924693
#>  [2,] 0.018708559 0.6366479 0.363352079
#>  [3,] 0.603790548 0.7843402 0.215659802
#>  [4,] 0.026762597 0.4336132 0.566386827
#>  [5,] 0.001245758 0.6553790 0.344620999
#>  [6,] 0.005180032 0.4848650 0.515135012
#>  [7,] 0.245424607 0.2615073 0.738492680
#>  [8,] 0.375255727 0.9915906 0.008409427
#>  [9,] 0.115455134 0.3657536 0.634246439
#> [10,] 0.179733058 0.2430331 0.756966862