G_priorDensity {IMIFA} | R Documentation |
Plot Pitman-Yor / Dirichlet Process Priors
Description
Plots the prior distribution of the number of clusters under a Pitman-Yor / Dirichlet process prior, for a sample of size N
at given values of the concentration parameter alpha
and optionally also the discount
parameter. Useful for soliciting sensible priors (or fixed values) for alpha
or discount
under the "IMFA"
and "IMIFA"
methods for mcmc_IMIFA
.
Usage
G_priorDensity(N,
alpha,
discount = 0,
show.plot = TRUE,
type = "h")
Arguments
N |
The sample size. |
alpha |
The concentration parameter. Must be specified and must be strictly greater than |
discount |
The discount parameter for the Pitman-Yor process. Must be less than 1, but typically lies in the interval [0, 1). Defaults to 0 (i.e. the Dirichlet process). When |
show.plot |
Logical indicating whether the plot should be displayed (default = |
type |
The type of plot to be drawn, as per |
Details
All arguments are vectorised. Users can also consult G_expected
, G_variance
, and G_calibrate
in order to solicit sensible priors.
Value
A plot of the prior distribution if show.plot
is TRUE
. Density values are returned invisibly. Note that the density values may not strictly sum to one in certain cases, as values small enough to be represented as zero may well be returned.
Note
The actual density values are returned invisibly. Therefore, they can be visualised as desired by the user even if show.plot
is FALSE
.
Requires use of the Rmpfr
and gmp
libraries; may encounter difficulty and slowness for large N
, especially with non-zero discount
values. Despite the high precision arithmetic used, the functions can be unstable for small values of discount
.
Author(s)
Keefe Murphy - <keefe.murphy@mu.ie>
References
De Blasi, P., Favaro, S., Lijoi, A., Mena, R. H., Prunster, I., and Ruggiero, M. (2015) Are Gibbs-type priors the most natural generalization of the Dirichlet process?, IEEE Transactions on Pattern Analysis and Machine Intelligence, 37(2): 212-229.
See Also
Examples
# Plot Dirichlet process priors for different values of alpha
(DP <- G_priorDensity(N=50, alpha=c(3, 10, 25)))
# Verify that these alpha/discount values produce Pitman-Yor process priors with the same mean
alpha <- c(19.23356, 6.47006, 1)
discount <- c(0, 0.47002, 0.7300045)
G_expected(N=50, alpha=alpha, discount=discount)
# Now plot them to examine tail behaviour as discount increases
# Non-zero discount requires loading the "Rmpfr" library
suppressMessages(require("Rmpfr"))
(PY <- G_priorDensity(N=50, alpha=alpha, discount=discount, type="l"))
# Other special cases of the PYP are also facilitated
G_priorDensity(N=50, alpha=c(alpha, 27.1401, 0),
discount=c(discount, -27.1401/100, 0.8054448), type="b")