generate stick-breaking prior (truncated) from a vector of random probabilities
Source:R/utils.R
tsb.Rd
generate stick-breaking prior (truncated) from a vector of random probabilities
Examples
oldpar <- graphics::par(mfrow=c(3,3),oma=c(0,1,5,0),
mar=c(1,2,1,1))
for (iter in 1:9){
u <- c(rbeta(9,1,0.8),1)
res <- tsb(u)
barplot(res,ylim=c(0,1),main=paste0("Random Sample #", iter),ylab="Probability")
}
graphics::mtext("Truncated Stick-Breaking Dist. (10 segments)",3,
outer=TRUE,cex=1.5,line=1.5)
par(oldpar)