Models of Learning

Developed by
Jill O'Reilly
Hanneke den Ouden
-August 2015

Fitting simulated data using a grid search

So - we have a model. What does it mean to 'fit' the model to data?

  • We need to determine the values of the parameters, α and β, that make the model behave as similarly to the real participant as possible.

As a 'sanity check', we will first fit the model to the simulated data,i.e. estimate the parameter values from the observed choices, to see how well we can 'recover' the parameters we put in.

  • For the simulated data, we know the values of the parameters α and β
    • In the simulated data, α and β are parameters we set ourselves
    • In real subjects' data, α and β are unknown

Grid search

There are various ways you could determine the best-fitting values of α and β.

We are going to use a grid search, which means:

  • We run the model with a whole range of values of α and β
  • For each pair α,β we work out how well the model predicts the data
    • This is defined as the likelihood of the parameters given the observed data
  • We can plot the outcome as a colourful grid!

OPTIONAL: MECHANICS of the GRID SEARCH

Note about using the grid search approach

The grid search approach is conceptually simple, easy to implement, and results are easy to visualise . However, with models with a larger number of parameters, the computational time and memory quickly explode, even for relatively coarse bins. In addition, you might want to constraint your parameters in other, more complex ways. For example, you might want to constrain your parameters using informative priors (other than the hard bounds we've used here), or even use 'empirical' priors in a hierarchical mixed model approach. Or you might want to use a sampling approach, such as MCMC. Details about these other approaches goes beyond the scope of this tutorial. Rather, we hope that an understanding the basic grid search will provide you with a firm grounding to explore these other options by yourself.

Running a grid search
So we will leave these complexities for now and set up the grid search:
go into the Matlab file RLtutorial_main.m, and set:

subjects = 1;
simulate = true;
fitData = true;
plotIndividual = true;

if simulate
simpars.alpha = .25;
simpars.beta = 4;
end

if fitData
bounds = [0 1; % alpha
0 15]; % beta
nBin = [20 25];
end

... save, and run!

This gives you a plot of the likelihood for all of the bins in a 2D plot.

?

►►►