This approach is perhaps more complex than it needs to be. See this thread for another example which has implemented discounting models Replacing nested for loops from JAGS code for cognitive model of temporal discounting - #6 by drbenvincent
1 Like