
Dirichlet-process posterior for the mass of a single set
Source:R/bnp_ghosal.R
morie_gh_dp_posterior.RdGiven a Dirichlet process prior with precision alpha and base
measure value G0_A on a set A, and n_in_A of n
observations falling in A, returns the mean and variance of the
(beta) posterior of \(G(A)\). The posterior mean is the precision-
weighted mixture of prior and empirical mass; the variance is that of
a beta with the updated precision alpha + n.
Value
list with elements mean (posterior mean of
\(G(A)\)), var (posterior variance) and precision
(the updated precision alpha + n)
References
Ghosal, S. and van der Vaart, A. (2017). Fundamentals of Nonparametric Bayesian Inference. Cambridge University Press.
Examples
morie_gh_dp_posterior(G0_A = c(1, 2, 3, 4, 5, 6, 7, 8), alpha = 0.5,
n_in_A = c(1, 2, 3, 4, 5, 6, 7, 8), n = 5L)
#> $mean
#> [1] 0.2727273 0.5454545 0.8181818 1.0909091 1.3636364 1.6363636 1.9090909
#> [8] 2.1818182
#>
#> $var
#> [1] 0.03051494 0.03814367 0.02288620 -0.01525747 -0.07628735 -0.16020343
#> [7] -0.26700572 -0.39669421
#>
#> $precision
#> [1] 5.5
#>