
Distribution function of the median of a Dirichlet process
Source:R/bnp_ghosal.R
morie_gh_dp_median_cdf.RdEvaluates \(P(\mathrm{median}(G) \le x)\) at the point where the
base measure has value G_x. Because \(G(x)\) is
\(Beta(\alpha G_0(x), \alpha (1 - G_0(x)))\) and the median of
\(G\) is at most x exactly when \(G(x) \ge 1/2\), the
answer is the beta tail probability above \(1/2\), computed here by
a midpoint rule with n_grid panels on \((1/2, 1)\).
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_dp_median_cdf(V, V)
#> [1] 0