block sampling

Help
S. N.
2013-03-05
2013-03-06
  • S. N.

    S. N. - 2013-03-05

    Hi. I want to try block sampling to improve convergence with a dataset with unequal samples. Here is a simple first model that I wanted to test, but I seem to have trouble going from the vector to the scalar nodes and receive "Attempt to redefine node c[1]". I tried all kinds of things, but either my syntax is off or my approach is faulty. Please suggest how I can go about fixing it. If you have any other strategies in mind, or article references that would be much appreciated, too.

         for (i in 1:subj)    {
    
         HR[i] ~ dbin(h[i],S) 
         FA[i] ~ dbin(f[i],N)
    
         h[i] <- phi(d[i]/2-c[i])
         f[i] <- phi(-d[i]/2-c[i])
      }
    
         for (j in 1:9) {
             for (i in 1:subj) {
    
         c[i] ~ dnorm(grp.muC.muD[j],tauC[conds[i]])
         d[i] ~ dnorm(grp.muC.muD[j],tauD[conds[i]])
    
            }
       }
    
         for (cond in 1:(allcond)) {
    
             tauC[cond] ~ dgamma(.01,.01) 
             tauD[cond] ~ dgamma(.01,.01)
    
       }
    
         grp.muC.muD[1:18] ~ dmnorm(grp.means[],grp.prc[,])
    
         #Passed as data
         grp.means[1:18] <- zers 
         grp.prc[1:18,1:18] <- iden
    
     
  • Luc Coffeng

    Luc Coffeng - 2013-03-06

    The error is in the second loop where you are redefining c[i] j times:

    for (j in 1:9) {
        for (i in 1:subj) {
            c[i] ~ dnorm(grp.muC.muD[j],tauC[conds[i]])
            d[i] ~ dnorm(grp.muC.muD[j],tauD[conds[i]])
        }
    }
    

    Remember that for every j, the inner loop for i is repeated. You are missing the index j in node c. This should be c[i,j]; according to your model, the expected mean of c differs per group j as well! Synchronize this line of thinking with the rest of the model and make sure that you provide the right indexing for your nodes. As you haven't explained the context of the model, I can not tell what it should be (except that you are missing index j in node c). I suspect that each subject i also belongs to some group j, which means that the first loop in your model should also be adjusted such that index j is in there.

    Best,
    Luc

     

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

Sign up for the SourceForge newsletter:





No, thanks