Regression in JAGS 2.0

Help
2010-04-30
2012-09-01
  • Kevin S. Van Horn

    I'm seeing a model that worked with JAGS 1.0.4 have problems in JAGS 2.0. I've
    appended the model to the end of the post. I used the model itself to generate
    synthetic data for testing (you'll notice the priors are all informative). In
    JAGS 1.0.4 I had no problem running the model. In JAGS 2.0., when I try
    running the model, beginning with "adapt 1000, by(10)", I get the following
    error message:

    RUNTIME ERROR:

    Error in Slicer: Current value is inconsistent with data

    This occurs immediately.

    Here is the model. In the data I used N.resp <- 50, N.obs <- 15, N.alt <- 5,
    and N.attr <- 20. Also, the X and Y arrays were sized for 500 respondents
    instead of 50 in the data file. I've also tried some variations on this, as
    you can see from the commented out code for max.util.

    model {

    for (resp in 1:N.resp) {

    for (obs in 1:N.obs) {

    for (alt in 1:N.alt) {

    log(exp.util) <-

    util # - max.util

    util <-

    inprod(X[V, obs, alt, ], beta)

    }

    max.util <- max(util)

    Y ~ dcat(exp.util)

    }

    for (attr.num in 1:N.attr) {

    beta ~ dnorm(beta.bar, tau)

    }

    }

    for (attr.num in 1:N.attr) {

    tau <- pow(sigma.beta, -2)

    sigma.beta ~ dunif(0, max.sigma.beta)

    beta.bar ~ dnorm(mu.beta.bar, sigma.beta.bar)

    }

    }

     
  • Martyn Plummer

    Martyn Plummer - 2010-04-30

    It's not necessarily a regression. There might actually have been something
    wrong with your model before, but JAGS missed it.

    In any case, this isn't a full bug report as it does not include the data and
    initial values, so I can't do much with it. You can simulate some data if you
    like, but I need a reproducible example.

     
  • Kevin S. Van Horn

    I don't see any way to attach files to a forum post, so I'll send them in an
    email. Thanks.

     
  • Martyn Plummer

    Martyn Plummer - 2010-05-02

    OK, there are three different changes between 1.0.4 and 2.0.0 that contributed
    to this

    • All nodes are deterministically initialized to a "typical" value. Previously random effects were stochastically initialized
    • The sampling order has changed. Now the nodes are sampled in the order in which they are created by the compiler. This is actually a mistake: they should be sampled in reverse order
    • There is a new TruncatedGamma sampling method which is used when you put a uniform prior on the standard deviation of a normal distribution. This method cannot cope with the situation where the sample variance of the random effects is zero

    You have two solutions. The first is to turn off the TruncatedGamma sampler:

    set factory "bugs::Conjugate" off, type(sampler)
    

    The second is to manually initialize all your random effects. Meanwhile I will
    put bug fixes in the patched branch.

     
  • Kevin S. Van Horn

    Thank you very much for your help. BTW, what was the reason for the change in
    initialization from 1.0.4? I'm just starting to use JAGS, but with BUGS I
    found the random initialization option to be very convenient at times. In
    fact, I have found it useful to have fixed effects also be randomly sampled
    when I have a moderately informative prior; it's a very easy way to get over-
    dispersed starting points for multiple chains.

     

Log in to post a comment.