tsb | R Documentation |
generate stick-breaking prior (truncated) from a vector of random probabilities
tsb(u)
u |
a vector of probabilities, with the last element 1.
Each element means the fraction of what is left to be broken. The last
element is 1 because we truncate the length of the stick to be |
a vector of the same length as u; sum to 1.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.