The stick breaking function produces a vector of probabilities that add up to one,
based on a series of individual probabilities in z
, which define the breaking
points relative to the remaining stick length. The first element of z
determines
the first probability based on breaking a proportion z[1]
from a stick of length one.
The second element of z
determines the second probability based on breaking a
proportion z[2]
from the remaining stick (of length 1-z[1]
), and so forth.
Each element of z
should be in
\((0,1)\).
The returned vector has length equal to the length of z
plus 1.
If z[k]
is equal to 1 for any k
, then the returned vector has length smaller than z
.
If one of the components is smaller than 0 or greater than 1, NaN
s are returned.