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.159551978 0.6037786175 0.2366694 0.14241759 0.59157967 0.017978257
#>  [2,] 0.536680360 0.1208957646 0.3424239 0.26116626 0.59570755 0.130937858
#>  [3,] 0.066913271 0.6026684770 0.3304183 0.03272872 0.42254970 0.009289538
#>  [4,] 0.110555641 0.0583075054 0.8311369 0.25649604 0.23304452 0.228951359
#>  [5,] 0.922971678 0.0663159220 0.0107124 0.12742798 0.22785739 0.412673895
#>  [6,] 0.097903872 0.6059385154 0.2961576 0.19991321 0.36293047 0.189342708
#>  [7,] 0.116685817 0.1992393599 0.6840748 0.30807952 0.07501580 0.459570151
#>  [8,] 0.760065255 0.0006966558 0.2392381 0.10423003 0.30270546 0.574355948
#>  [9,] 0.001674424 0.4939609529 0.5043646 0.15955906 0.21474925 0.021901144
#> [10,] 0.081869025 0.3161200148 0.6020110 0.08901938 0.08941726 0.794800758
#>             [,7]       [,8]        [,9]
#>  [1,] 0.24802448 0.01434301 0.985656989
#>  [2,] 0.01218833 0.99875424 0.001245758
#>  [3,] 0.53543203 0.75834038 0.241659622
#>  [4,] 0.28150808 0.99481997 0.005180032
#>  [5,] 0.23204074 0.35334638 0.646653617
#>  [6,] 0.24781361 0.84186083 0.158139166
#>  [7,] 0.15733453 0.63125573 0.368744270
#>  [8,] 0.01870856 0.75457539 0.245424607
#>  [9,] 0.60379055 0.38456020 0.615439803
#> [10,] 0.02676260 0.62474427 0.375255727