(a <- uniform(3))
a[c(TRUE,TRUE,FALSE)] <- 0.3
(a <- as.hyperdirichlet(a, calculate_NC = TRUE)) # recommended way to calculate NC
(b <- dirichlet(1:3))
as.hyperdirichlet(b) # "forgets" the normalizing constant
as.hyperdirichlet(b, TRUE) # recalculates NC; accuracy tolerable
# (analytic answer = 1/60)
# takes a long time
op <- options()
options(warn = -1)
x <- dirichlet(rep(2,4)) + justpairs(matrix(1,4,4))
f <- function(p){p[1]>p[2]}
probability(x,f) # should be 0.5: distribution is symmetric
d <- dirichlet(1:3)
colMeans(rhyperdirichlet(1e3,d)) # should be (1:3)/6; implementation includes a bugfix sent by Simon ByrneRun the code above in your browser using DataLab