random_init_simplex {genscore} | R Documentation |
Generates a random point in the (p-1)-simplex.
Description
Generates a random point in the (p-1)
-simplex.
Usage
random_init_simplex(p, rdist = stats::rnorm, tol = 1e-10, maxtimes = 100)
Arguments
p |
An integer, the dimension. |
rdist |
A function that generates a random number when called using |
tol |
A small positive number. Samples are regenerated until each of the |
maxtimes |
An integer, maximum number of attempts. |
Details
p
numbers are generated from rdist
and their absolute values are normalized to sum to 1. This will be repeated up to maxtimes
times until all p
components are larger than or equal to tol
.
Value
A random point (p
-vector) in the (p-1)
-simplex, i.e. sum(x) == 1 && x > 0
.
Examples
random_init_simplex(100, stats::rnorm, 1e-10, 100)
[Package genscore version 1.0.2.2 Index]