Skip to contents

Evaluates \(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)\).

Usage

morie_gh_dp_median_cdf(G_x, alpha, n_grid = 4000L)

Arguments

G_x

base-measure value \(G_0(x)\) at the point of interest, in \((0, 1)\)

alpha

Dirichlet-process precision (positive)

n_grid

number of midpoint quadrature panels on \((1/2, 1)\); defaults to 4000

Value

numeric scalar, the probability that the Dirichlet-process median does not exceed 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_dp_median_cdf(V, V)
#> [1] 0