Implements the stick breaking algorithm for calculating weights in the stable-var scheme.
Arguments
- Z
Numeric array. Input array, shape [A, K]
. Must not contain NA values.
Value
Numeric array. Stick breaking weights, shape [A, K]
. Must not contain NA values.
Examples
set.seed(123)
Z <- array(runif(10), dim = c(2, 5))
stick_breaking(Z)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.2875775 0.4089769 0.940467284 0.5281055 0.5514350
#> [2,] 0.5616063 0.5218837 0.002712102 0.4211276 0.2048214