hyperdirichlet-package {hyperdirichlet} | R Documentation |
A generalization of the Dirichlet distribution
Package: | hyperdirichlet |
Type: | Package |
Version: | 1.0 |
Date: | 2008-03-26 |
License: | What license is it under? |
This package provides a generalization of the Dirichlet distribution that is useful for analyzing multinomial trials with a priori restrictions.
As an example, consider six people (“players”), numbered 1 to 6. These players are members of a running club and regularly race one another.
Each player has an associated number p_1 to p_6, with 0 <= p_i <= 1 for 1,...,6 and p_1 + ... + p_6=1. If all six take part in a race, then the probability that player i wins is simply p_i.
We wish to make inferences about the p_i from their performances.
If all six race and p_i wins n_i, then the likelihood function is just
p1^n1 * p2^n2 * p3^n3 * p4^n4 * p5^n5 * p6^n6.
With a uniform prior, the posterior is Dirichlet.
The players now have a race but only p_1, p_2 and p_3 take place, winning r_1, r_2 and r_3 respectively. The likelihood function is then
p1^n1 * p2^n2 * p3^n3 * p4^n4 * p5^n5 * p6^n6 / (p1+p2+p3)^(r1+r2+r3)
This distribution is not a Dirichlet distribution but is representable in this package; the R idiom would be
jj <- dirichlet(powers = c(5,4,3,5,3,2))
jj <- jj + mult_restricted_obs(6, 1:3, c(4,5,2))
where the first line specifies a Dirichlet distribution for the all-play data and the second line augments the likelihood with the observations from the restricted race.
Robin K. S. Hankin
jj <- dirichlet(powers = c(5,4,3,5,3,2)) jj <- jj + mult_restricted_obs(6, 1:3, c(4,5,2)) data(icons) max.like(as.hyperdirichlet(icons))