Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

how to use dcat function for mixture distributions

Help
2013-08-13
2013-08-13
  • Dear all,

    I am trying to implement a JAGS model that takes as a prior a Mixture Model made out of 5 Gaussian distributions. These distributions differ only in term of their means.

    Now, I'd like to sample with equal probability from everyone of these but, for some reason, it seems that the algorithm is not taking into account the probabilities that I am providing to the dcat function. (This code behaves ignoring the probabilities from 2 to 5 and samples ONLY from the mean.m[1])

    Any help would be very much appreciated

    Giovanni

    Here is an example of what I have written:

    # 5 different means
    mean.m[ 1 ] <- 0.000000 + 1.0E-12 
    mean.m[ 2 ] <- 1.570796
    mean.m[ 3 ] <- 3.141593
    mean.m[ 4 ] <- 4.712389
    mean.m[ 5 ] <- 6.283185 - 1.0E-12
    
    # common precision
    precis.m     ~ dunif( 40 , 50 )
    
    # equal prior probability
    pr.m[ 1 ] <- 0.2  
    pr.m[ 2 ] <- 0.2
    pr.m[ 3 ] <- 0.2
    pr.m[ 4 ] <- 0.2
    pr.m[ 5 ] <- 0.2
    
    # Mixture Model
    M           ~  dcat( pr.m[] )
    D           <- mean.m[ M ]
    tau         ~ dnorm( D , precis.m )T( 0 , 6.283185 )