What really means the error "Inconsistent arguments for logDensity in distribution dsum"? Are there any working example with dsum?

Help
2013-05-27
2013-05-30
  • Adam Ryczkowski

    Adam Ryczkowski - 2013-05-27

    I try my luck with dsum to model an observed variable that is known to be a sum of two latent variables (see http://sourceforge.net/p/mcmc-jags/feature-requests/5 on my failures on more straightforward efforts with input[2] ~ dnorm(s1+s2,25)).

    I came up with the following model:

    var
       input[2], #Input: Log hazard ratio wynikający z badania
       tau,
       s1,
       s2
    model{
    input[1] ~ dnorm(i1,50)
    input[2] ~ dsum(i1,i2)
    i1 ~ dnorm(0,tau)
    i2 ~ dnorm(0,tau)
    tau~dgamma(0.001,0.001)
    }
    

    Upon compilation I've got

    RUNTIME ERROR:
    Inconsistent arguments for logDensity in distribution dsum
    

    error. It can well be my failure with understanding of how to use the dsum distribution (it's the first time I try to use it), but I can't find any working examples on the net.

     
  • Martyn Plummer

    Martyn Plummer - 2013-05-30

    You have to supply appropriate starting values. JAGS will automatically generate starting values for you based on the prior distributions of the stochastic nodes in the model. But observable functions - like dsum - impose a posteriori constraints. In your example, i1 and i2 must add up to input[2]. This a posteriori constraint will not be satisfied by the automatically generated initial values.

     

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

Sign up for the SourceForge newsletter:





No, thanks