R/msBP.leaf.allocation.R

Defines functions msBP.leaf.allocation

Documented in msBP.leaf.allocation

msBP.leaf.allocation <-
function(y, scale=4)
{
n <- length(y)
s <- rep(scale, n)
h <- rep(NA, n)
for(i in 1:n)
{
	prob <- rep(0, 2^scale)
	for(j in 1:(2^scale))
	{
		prob[j] <- dbeta(y[i], j, 2^scale - j +1)
	}
	h[i] <- min(c(1:(2^scale))[prob == max(prob)])
}
list(s=s, h=h)
}

Try the msBP package in your browser

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

msBP documentation built on Aug. 23, 2023, 1:06 a.m.