msBP.rsample: Random numbers from a random msBP densty

View source: R/msBP.rsample.R

msBP.rsampleR Documentation

Random numbers from a random msBP densty

Description

Random numbers generation from a random density drawn from a msBP process.

Usage

msBP.rsample(n, msBPtree)

Arguments

n

Size of the sample to be generated

msBPtree

An object of the class msBPtree

Value

A vector containing the random sample

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

rand.tree <- msBP.rtree(50,2, 4)
rand.samp <- msBP.rsample(50, rand.tree)
hist(rand.samp, prob=TRUE)
prob <- msBP.compute.prob(rand.tree)
density <- msBP.pdf(prob, 100)
points(density$dens~density$y, ty='l', col=4)

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