hd_add: Add two hyperdirichlet distributions

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
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

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

Value

Returns a hyperdirichlet distribution

Author(s)

Robin K. S. Hankin

See Also

hyperdirichlet,is.proper,Arith

Examples

1
2
3
4
5
6
7
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)))

hyperdirichlet documentation built on May 31, 2017, 5:18 a.m.

Search within the hyperdirichlet package
Search all R packages, documentation and source code