Jeromy Anglim's Notes

Assorted notes on statistics, R, psychological research, LaTeX, computing, etc. See also my primary blog for more substantive posts: jeromyanglim.blogspot.com
  • rss
  • archive

Tags:
  • R
  • LaTeX
  • Linux / Ubuntu
  • OSX
  • Jags
  • Tumblr

Previous Notes:
Main Blog:
  • Jags error: “Error: Logical node and cannot be observed”

    I was trying to run a JAGS model of a vector of data Y1; part of the code is extracted as follows:

    Y1[i] <- Mu[i] + E[i]
    Mu[i] ~ dnorm(Delta, TauPrecision)
    E[i] ~ dnorm(0, SigmaPrecision)
    

    When I ran jags.model(...), I received the following error:

    Error in jags.model("m2-complete-jags.txt", data = jagsdata.Y1, n.chains = 4,  : 
      RUNTIME ERROR:
    Compilation error on line 5.
    Y1[1] is a logical node and cannot be observed
    
    • What caused this?

    Observed variables like Y1 need to be assigned a distribution. Thus, the code needed to be rewritten to

    Y1[i] ~ dnorm(Mu[i], SigmaPrecision)
    Mu[i] ~ dnorm(Delta, TauPrecision)
    
    • December 7, 2012 (10:28 am)
    • #@jags
  • comments powered by Disqus