msBP.density: Random probability density function and random cumulative...

msBP.pdfR Documentation

Random probability density function and random cumulative distribution function from a msBP

Description

Compute the density and the cumulative distribution functions of a random density drawn from an msBP(a,b) process

Usage

msBP.pdf(weights, n.points, y)
msBP.cdf(weights, n.points, log, y)

Arguments

weights

An object of the class binaryTree containing probability weights

n.points

Length of the grid over (0,1) in which calculate the value of the random density

log

Logical. TRUE for computing the log-cdf

y

Vector of values in which the random density is evaluated. If used, n.points is not considered.

Value

Vector of size n.points or length(y)

References

Canale, A. and Dunson, D. B. (2016), "Multiscale Bernstein polynomials for densities", Statistica Sinica, 26(3), 1175-1195.

Canale, A. (2017), "msBP: An R Package to Perform Bayesian Nonparametric Inference Using Multiscale Bernstein Polynomials Mixtures". Journal of Statistical Software, 78(6), 1-19.

See Also

msBP.rtree

Examples

prob <-structure(list( T = list(0.15, c(0.05,0.05), c(0.05,0.2,0.1,0.1), 
		c(0,0,0.3,0,0,0,0,0) ), max.s=3), class  = "binaryTree")
density <- msBP.pdf(prob, 100)
probability <- msBP.cdf(prob, 100)
par(mfrow=c(1,2))
plot(density$dens~density$y, ty='l', main = "pdf")
plot(probability$prob~density$y, ty='l', main = "cdf")

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