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

Close

Unable to resolve node

Help
stat-up
2014-05-16
2014-05-19
  • stat-up
    stat-up
    2014-05-16

    Hi,

    I have a model that works:

    for(i in 2:length(t)) {
      mu.s[i]<-a*x[i]
      t[i] ~ dnorm(mu.s[i], tau.s)  
    }
    a ~ dlnorm(0, 0.0625)
    
    v.s ~ dlnorm(0, 0.0625)
    tau.s<-1/pow(v.s, 2)
    

    but now I want to trace the mean of the mu.s and so I add the line

    mn<-mean(mu.s)
    

    at which point I get an "unable to resolve node mu.s[1:1000]". I assume because JAGS expects a distribution for mn. But how would I correctly trace some function of the model variables without making any changes to the model itself?

    And I'd be really grateful if somebody could enlighten me.

    Stefan
    ~~~

     
    Last edit: stat-up 2014-05-16
  • Martyn Plummer
    Martyn Plummer
    2014-05-16

    The node mu[1] is undefined. You probably want

    mn <- mean(mu.2[2:length(t)])
    
     
  • stat-up
    stat-up
    2014-05-19

    aaaaaaahh, thank you very much.