R/msBP.density.R

Defines functions msBP.cdf msBP.pdf

Documented in msBP.cdf msBP.pdf

msBP.pdf <-
function(weights, n.points, y=NULL)
{
if(is.null(y))
{
if(n.points<2) stop("n.points must be an integer greater than 2")
grid <- seq(0.001, 0.999, length=n.points)
}
else
{
	grid = y
	n.points = length(y)
}
	w <- tree2vec(weights)
res <- .C("dmsBP_C", as.double(w), as.double(grid), as.integer(n.points), as.integer(weights$max.s), 
	ans = as.double(rep(0, n.points)), PACKAGE = "msBP")
list(y=grid,dens=res$ans)
}

msBP.cdf <-
function(weights, n.points, log=FALSE, y=NULL)
{
	if(is.null(y))
	{
	if(n.points<2) stop("n.points must be an integer greater than 2")
	grid <- seq(0.001, 0.999, length=n.points)
	}
	else
	{
		grid = y
		n.points = length(y)
	}
	w <- tree2vec(weights)
	res <- .C("pmsBP_C", as.double(w), as.double(grid), as.integer(n.points), as.integer(weights$max.s), 
	ans = as.double(rep(0, n.points)), as.integer(log), PACKAGE = "msBP")
	list(y=grid,prob=res$ans)
}

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.