So I currently have a model that is fitting to some 'number of trials where reply is yes'
You don't really need to know the details I believe but it's a hierarchical model where the data is a 3d array (2 conditions * 48 participants * 7 trial types). The final line is
resp_diff[i,j,k] ~ dbin(pdiff[i,j,k],trials[i,j,k])
This is that the predicted number of 'yes' responses is drawn binomially with probability pdiff[i,j,k] over a number of trials in this type/condition/participant trials[i,j,k].
This functions fine and gets me good fits and reasonable parameter estimates.
However, now I wanted to add the possibility that the 'yes' response is not related to the pdiff at all, and is instead for some proportion of trials a random decision (e.g. the participant wasn't paying attention, misclicked, whatever).
So I've added in a node lapse[i] for each participant, that should represent the probability of 'guessing' on any one trial. The bottom line is then instead replaced with
trials_lapse[i,j,k] ~ dbin(lapse[i],trials[i,j,k])
trials_reg[i,j,k] <- trials[i,j,k]-trials_lapse[i,j,k]
diff_lapse[i,j,k] ~ dbin(0.5,trials_lapse[i,j,k])
diff_reg[i,j,k] ~ dbin(pdiff[i,j,k],trials_reg[i,j,k])
resp_diff[i,j,k] ~ dsum(diff_reg[i,j,k],diff_lapse[i,j,k])
That is to say that we now separate the total number of trials[i,j,k] into 'regular' trials (whose responses are dependent on the model above) and lapse trials (where concentration has 'lapsed'), and then draw separately for each of those how many 'yes' responses we get due to guesses and how many due to model-based answers. These are then summed at the end and we still have that resp_diff[i,j,k] is fitted to an R array resp_diff whose data is fed into the JAGS model.
This doesn't work, I get the error
Error in node diff_reg[1,1,1]
Node inconsistent with parents
I can't for the life of me figure out why this is happening but I assume it's somehow related to my misunderstanding of the dsum function. I tried regular 'sum' too with no luck.
What am I doing wrong here? Any help would be hugely appreciated!
Thanks,
H