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

Close

Model not converging

Help
Tom Lloyd
2014-06-03
2014-06-04
  • Tom Lloyd
    Tom Lloyd
    2014-06-03

    Thanks in advance for any guidance on this. I have an ongoing issue with non convergence within JAGS.
    I'm running quite a simple model which converges fine in WinBUGS but two of the parameters will not converge in JAGS. The problem is solved if I standardise the data, but I am more fundamentally wondering if I am doing something wrong in JAGS simply because it converges so easily in WinBUGS unstandardised.

    I am using initial values of -1 and 1 for the two chains

    model {
    for (j in 1:157) {
    dep[j] ~ dnorm(mu[j],tau)
    mu[j]<-
    beta[1] * i1[j] +
    beta[2] * i2[j] +
    beta[3] * c[j]
    }
    beta[1] ~ dnorm(0,0.00001)
    beta[2] ~ dnorm(0,0.00001)
    beta[3] ~ dnorm(0,0.00001)
    tau~dgamma(0.05,0.05)
    }

    load dic
    model clear
    model in "hvassjags.mod"
    data in "hvassjags.dat"
    compile, nchains(2)
    parameters in "hvassjagsinits_1.txt"
    parameters in "hvassjagsinits_2.txt"
    initialize
    update 1
    monitor beta, thin(1)
    monitor deviance, thin(1)
    update 10000
    coda *,stem(hvassCODA)

    Happy to provide the data, thanks for any help.

     
  • Martyn Plummer
    Martyn Plummer
    2014-06-03

    Load the "glm" module before compiling the module. This will give block updating of beta[1:3] and fast mixing.

    WinBUGS does block updating automatically.

     
  • Martyn Plummer
    Martyn Plummer
    2014-06-03

    Incidentally, you can write the linear predictor as

    mu[j]<-
    beta[1] * i1[j] +
    beta[2] * i2[j] +
    beta[3]
    

    This makes it clear that beta[3] is the intercept term.

     
  • Tom Lloyd
    Tom Lloyd
    2014-06-03

    Many thanks Martyn, much appreciated. We will give it a go. Many thanks again. Tom

     
  • Tom Lloyd
    Tom Lloyd
    2014-06-04

    Thanks Martyn, worked a treat. Tom