| hd_add {hyperdirichlet} | R Documentation |
Given two hyperdirichlet distributions, “add” them, in the sense of concatenating their information, assumed to be independent.
hd_add(e1, e2, assume_validated = FALSE)
e1,e2 |
Hyperdirichlet distributions of the same dimension |
assume_validated |
Boolean, with default FALSE meaning
that the returned sum cannot be assumed to be proper; so the
returned hyperdirichlet object is tested with is.proper()
(which is time-consuming). Set to TRUE only when you know
that the sum is proper |
Think of this function as a computerized embodiment of Bayes's theorem
with e1 representing the prior and e2 representing one
or more informative trials.
The basic guts of the function is hyperdirichlet(powers(e1) +
params(e2)). Note that this is equivalent to
hyperdirichlet(params(e1) + powers(e2)).
The functional form is not really intended for the end user; use
e1 + e2 instead (but observe that the sum will be validated
using is.proper(), which may take a long time).
Returns a hyperdirichlet distribution
Robin K. S. Hankin
hyperdirichlet,is.proper,Arith
dirichlet(1:4) + gd(c(0.1 , 0.3 , 0.5), c(0.2 , 0.4 , 0.9)) uniform(4) + single_bernoulli_obs(4,1,2) data(chess) ch <- as.hyperdirichlet(chess) stopifnot(all(params(ch+ch+ch) == params(ch*3)))