Spatial models

  • Corey Sparks

    Corey Sparks - 2011-02-10

    Hello list,

    I am interested in using JAGS for a spatial model that I'm running into issues
    with in WinBUGS, basically because of the large number of stochastic nodes I
    need to monitor.

    I can't seem to find anything about functions like

    car.normal() or spatial.exp()

    in JAGS, has anyone else tried to do these kinds of models?

    If so would you be willing to share with me?

    Here's an example of one of my models bugs code:


    for (i in 1:N){

    ynh_~dbin(pnh_, nnh_)

    yh_~dbin(ph_, nh_)




    estimated rates





    end model

    unh~car.normal(adj,weights, num, precunh)

    uh~car.normal(adj,weights, num, precuh)




    alphanh~dnorm(0, .0001)

    alphah~dnorm(0, .0001)




  • Martyn Plummer

    Martyn Plummer - 2011-02-18

    Sorry but I don't use spatial models at all in my work so this is a low
    priority for me, even though it is a common feature request. I do have the
    books "Hierarchical modelling and analysis for spatial data" by Banerjee,
    Carlin and Gelfand as well as "Gaussian Markov Fields" by Rue and Held. But it
    might be a while before I've digested them and implemented anything in JAGS.

  • Mark Payne

    Mark Payne - 2013-12-10


    I was curious about this message and the status of spatial models in JAGS today (noting that the original post is now getting on towards three years old). Are there any plans to implement such spatial structures in JAGS? Alternatively, are there any good worked examples around that we could use as a DIY basis?

    Best wishes,


  • Matt Denwood

    Matt Denwood - 2013-12-11

    Hi Mark

    I have also (occasionally) missed the spatial models in WinBUGS, although like Martyn I don't use them often enough to warrant the time required to implement them in JAGS myself. However, if someone were able to write the C++ code necessary to implement some of the required distributions/samplers (the tricky bit) it would be relatively straightforward to implement these as a standalone JAGS module even if they are not incorporated into JAGS itself. There is a great tutorial article at that is worth reading - I have also created a module ( and would be happy to help with this side of things.



  • Mark Payne

    Mark Payne - 2013-12-16

    Hi Matt,

    Thanks for the reply. Unfortunately, I'm still a novice in the JAGS/Bayesian world, so extending JAGS is a bit beyond me yet... Hopefully I'm not the only one who is interested in using JAGS for Spatial Models though...

    Best wishes,



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

Sign up for the SourceForge newsletter:

No, thanks