Skip to contents

Locates x in the dyadic partition, counts how many of data share each of its first depth bit prefixes, and multiplies the level-wise posterior branching probabilities \((2 a_m + 2 N_m) / (2 a_m + N_{m-1})\), with the canonical level weights \(a_m = m^2\) and \(N_0\) the sample size. The result is the posterior density relative to the uniform base measure.

Usage

morie_gh_pt_posterior_density(x, data, depth = 4L)

Arguments

x

numeric scalar in \([0, 1)\) at which to evaluate the density

data

numeric vector of observations in \([0, 1)\)

depth

number of Polya-tree levels to use; defaults to 4

Value

numeric scalar posterior density at x

References

Ghosal, S. and van der Vaart, A. (2017). Fundamentals of Nonparametric Bayesian Inference. Cambridge University Press.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_gh_pt_posterior_density(V, V)
#> [1] 4.236923