Simulating data
We often think about modelling in terms of fitting a model to a participant's behaviour.
However, we can also use the model to simulate what an 'ideal' participant would do, given certain
values of the parameters such as learning rate.
This can help us get an intuitive understanding of:

how these parameters may describe behaviour

what sort of behaviour our model may capture
Therefore, before we are going to fit the behavioural data, we will first actually generate or simulate some data.
This means that we will use our model, which is simply the 2 equations above, to 'play' the slot machine game.
The equations
The codes implement the update and observation equations.

Open the file RLtutorial_simulate.m

Can you find the observation (softmax) equation?
?
ev = exp(beta*v); % exponentiate the value
sev = sum(ev); % compute the sum of the values
p = ev/sev; % probability each choice
% i.e. ratio of each of the values and their sum.
% This code effectively does:
% p(1) = ev(1)/sev;
% p(2) = ev(2)/sev;

Can you find the update (RescorlaWagner) equation?
?
dv = rv(c); % compute prediction error
v(c) = v(c) + alpha*dv; % update value
►►►