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: “Cannot evaluate upper index of counter”

    I received the following error when setting up my JAGS model:

    Error in jags.model("model.txt", data = jagsdata, n.chains = 4, n.adapt = 1000)
    : 
      RUNTIME ERROR:
      Compilation error on line 4.
      Cannot evaluate upper index of counter i
    

    I’d previously pasted the following code which corresponded to line 4 of the model:

    for (i in 1:length(Y)) { 
    

    The problem was that I’d changed the case of my actual data so that the y was meant to be lower case.

    for (i in 1:length(y)) { 
    

    The moral of the story: when pasting code from previous examples, make sure all the variable names are updated properly.

    • December 7, 2012 (10:22 am)
    • #@jags
  • comments powered by Disqus