Moment Matching the Dirichlet

Ann Raiho
  • Ann Raiho

    Ann Raiho - 2013-03-11


    A simplified representation of my model is:
    multinomial[y|N,P]dirichlet[P|alpha]dirichlet[alpha/sum(alphas)|Pi x sum(alphas)] [Pi|f(theta),sigma][theta] where f is the transition matrix that defines my process model.

    My problem is that I need to compute "alpha/sum(alphas)", but I cannot because it cannot be on the LHS twice in JAGS. I tried to compute this in the data block, but I could not because alphas depend on the process model as well as the data and because of this I don't think really want to define them as data anyway. I am using the Dirichlet to be able to include the standard deviations on the estimates of the alphas.

    What are your suggestions for this moment matching problem?

  • Martyn Plummer

    Martyn Plummer - 2013-03-13

    You can generate Dirichlet random variables as a normalized vector of independent variables with gamma distributions with the same shape parameter. Maybe you can work directly with gamma variables.

    Note also that the distributions that take a probability vector as a parameter, such as dmulti and ddirch will accept an unnormalized parameter vector and do the normalization internally.

    For example, this is valid:

    for (i in 1:n) {
       alpha[i] ~ dgamma(shape, 1)
    P[1:n] ~ dmulti(N, alpha[])
    Last edit: Martyn Plummer 2013-03-13
  • Ann Raiho

    Ann Raiho - 2013-04-08

    Thank you this was very helpful. We decided to use alphas ~ gamma to control the variance for each estimation of group composition. Like this:
    for (i in 1:rows){
    y.alpha[i,4:6] ~ dmulti(P[i,1:3],y.alpha[i,8])
    P[i,1:3] ~ ddirch(c[1:3,y.alpha[i,2]]*alpha[y.alpha[i,2]])


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks