don't want update on prior: problem with dsum()

  • Anonymous - 2013-02-20

    I want no update for a parameter. So for my JAGS code I have something like:
    para.fix ~ dsum(para)
    para ~ dunif(0,1)
    What I want is that the posteriors sample for para.fix is the same as the prior distribution unif(0,1). But the plot of posteriors sample for para.fix and unif(0,1) shows an update of para.fix which I don't want.

    I've tried using different versions of R (2.13 and 2.15), and different R packages (rjags and R2jags). But there's always update on para.fix. Seems to me that I was just making a copy of the posterior sample of para by using dsum(para). Can anyone tell me how to write the JAGS code for para.fix so that its posterior sample is the same as the prior unif(0,1)? Thanks a lot!

  • Martyn Plummer

    Martyn Plummer - 2013-02-25

    JAGS will sample a node from its prior distribution if it has no observed descendants. So, for example this simple model:

    model {
       para ~ dunif(0,1)

    will sample from a uniform distribution you do not supply a data value for para.

    • Anonymous - 2013-03-05

      Hi Martyn, thanks a lot for your reply. But what I mean here is that in the model

        y        ~ dnorm(para.fix, 0.1)
        para.fix ~ dsum(para)
        para     ~ dunif(0,1)

      para gets updated, e.g. when running with y=0 or y=5 gives different results. What I want is that by using dsum(para), the posterior sample of para is still the same as its prior unif(0,1). But now, para.fix and para have exactly the same posterior samples.

      Last edit: Anonymous 2013-03-05
  • Martyn Plummer

    Martyn Plummer - 2013-03-11

    It sounds like you want the cut function, which is implemented in OpenBUGS but not JAGS. See section 9.4 of The BUGS Book, by Lunn et al.

    The dsum distribution does not do what you want it to do.


Log in to post a comment.