R/Stick.R

Defines functions Stick

Documented in Stick

###########################################################################
# Stick                                                                   #
#                                                                         #
# The purpose of the Stick function is provide the utility of truncated   #
# stick-breaking regarding the vector theta.                              #
###########################################################################

Stick <- function(theta)
     {
     M <- length(theta) + 1
     theta <- c(theta, 1)
     p <- rep(theta[1], length(theta))
     for (m in 1:(M-1)) {
          p[m+1] <- theta[m+1] * (1-theta[m]) * p[m] / theta[m]}
     return(p)
     }

#End

Try the LaplacesDemon package in your browser

Any scripts or data that you put into this service are public.

LaplacesDemon documentation built on July 1, 2018, 9:02 a.m.