hyperdirichlet (version 1.5-1)

hd_add: Add two hyperdirichlet distributions

Description

Given two hyperdirichlet distributions, “add” them, in the sense of concatenating their information, assumed to be independent.

Usage

hd_add(e1, e2, assume_validated = FALSE)

Arguments

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

Value

Returns a hyperdirichlet distribution

Details

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).

See Also

hyperdirichlet,is.proper,Arith

Examples

Run this code

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)))

Run the code above in your browser using DataLab