Skip to contents

Converts stick fractions V into the weights \(w_j = V_j \prod_{l < j} (1 - V_l)\). Only the first length(V) weights are returned; the residual mass \(\prod_j (1 - V_j)\) is not appended, so the result sums to one only in the limit.

Usage

morie_gh_stick_breaking(V)

Arguments

V

numeric vector of stick fractions, each in \([0, 1]\); values outside the unit interval raise an error

Value

numeric vector of the same length as V holding the stick-breaking weights

References

Ghosal, S. and van der Vaart, A. (2017). Fundamentals of Nonparametric Bayesian Inference. Cambridge University Press.

Examples

V <- c(1/2, 1/3, 1/4, 1/5)
morie_gh_stick_breaking(V)
#> [1] 0.50000000 0.16666667 0.08333333 0.05000000