Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

hyperdirichlet (version 1.5-1)

hyperdirichlet-package:

Description

A generalization of the Dirichlet distribution

Arguments

Details

Package: hyperdirichlet
Type: Package
Version: 1.1-8
Date: 2008-03-26
License: GPL

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 p1 to p6, with 0pi1 for i=1,,6 and i=16pi=1. If all six take part in a race, then the probability that player i wins is simply pi.

We wish to make inferences about the pi from their performances.

If all six race and pi wins ni, then the likelihood function is just

p1n1p2n2p3n3p4n4p5n5p6n6.

With a uniform prior, the posterior is Dirichlet.

The players now have a race but only p1, p2 and p3 take place, winning r1, r2 and r3 respectively. The likelihood function is then

p1n1+r1p2n2+r2p3n3+r3p4n4p5n5p6n6(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.

References

Robin K. S. Hankin (2010). “A Generalization of the Dirichlet Distribution”, Journal of Statistical Software, 33(11), 1-18, http://www.jstatsoft.org/v33/i11/

Examples

Run this code

  jj <- dirichlet(powers = c(5,4,3,5,3,2))
  jj <- jj + mult_restricted_obs(6, 1:3, c(4,5,2))

data(icons)
maximum_likelihood(as.hyperdirichlet(icons))

Run the code above in your browser using DataLab