# Take The Best With Known Search Order model { # Observed Decisions for (i in 1:nq) { k[i] ~ dbern(theta[i,d1[i]]) } # TTB Decision for (i in 1:nq){ # Cue/Feature contributions to decision # the pow function is a weight so that the first discriminating feature determines the decision. for (j in 1:nc){ w[i,j] <- (c[p[i,1],j]-c[p[i,2],j])*pow(2,vo[j]-1) } # TTB takes the first feature, or they are not different # First object gives d1[i]=3, Second object gives d1[i]=1, Same gives d1[i]=2. The meaning of these values is coming! dtmp[i] <- sum(w[i,1:nc]) d[i] <- -1*step(-dtmp[i])+step(dtmp[i]) d1[i] <- d[i]+2 # Goes with TTB decision with probability gamma, or guesses. This means if we got a 1, then the city is not chosen by this feature. 3 means it was. 2 corresponds to the .5 uniform distribution - 50/50 chance. theta[i,1] <- 1-gamma theta[i,2] <- 0.5 theta[i,3] <- gamma # Whether decision was correct. correct[i] <- equals(k[i],1)*equals(d1[i],3) +equals(k[i],0)*equals(d1[i],1) +0.5*equals(d1[i],2) } # Proportion of correct decision, with hack to insure monitoring sc <- sum(correct[1:nq])/nq+gamma-gamma # Priors gamma ~ dbeta(1,1) }