# 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")
Run the code above in your browser using DataLab