Practical Introduction to Diffusion Modelling using the DMAT toolbox
DMAT is a Matlab toolbox for fitting the [http://126.96.36.199/coglab/ Ratcliff Drift Diffusion Model] to behavioural data (see [http://ppw.kuleuven.be/okp/software/dmat/ DMAT main page], incl. [http://ppw.kuleuven.be/okp/software/dmat/ DMAT publication] and [http://ppw.kuleuven.be/okp/_pdf/Vandekerckhove2008DMAWM.pdf "primer"]). See the following page for a [http://toolsandtutorials.pbworks.com/w/page/37703696/Commonly-Used-DMAT-Commands#multiestv4 list of DMAT commands].
The following will show you how to get started with the DMAT toolbox.
First things first: In order to use the Matlab toolbox on our linux system, start Matlab and type "dmat" in the command window - this will set the necessary paths etc.
The format of the input for DMAT should be in a form like this:
data = [ ... 1 1 0.5223 1 0 0.6661 2 1 0.9812 2 0 0.4932 3 1 0.4112 3 0 0.8342 ...]
The first column codes your "conditions", i.e. subsets of your data the may be allowed to differ from the rest in some way in the later analysis. This could be separate subjects, or both different experimental conditions and subjects. You can later specify (by means of "design matrices") what you want to keep constant across subjects, across conditions, within subjects etc. (please be patient...).
The second column codes whether a response was "correct" (1) or "incorrect" (0).
The third column contains the response times - make sure they are in seconds (not milliseconds)!
You could already fit the diffusion model using default parameters on these data with the function "multiestv4":
ddmoutput = multiestv4( data );
In this case, you will get one set of fitted parameters for the whole data set, i.e. not for individual condtions.
The result will be in
The output parameters appear in the following sequence:
- 1: Boundary Separation, a
- 2: non-decision time (t_er)
- 3: intertrial standard deviation of drift rate
- 4: starting point, z
- 5: range of z, (s_z, uniform)
- 6: range of t_er (s_t, uniform)
- 7: accumulation/drift rate
Specifying Input Options, Fitting Multiple Models
You can specify a range of different input options, or "models", for DMAT. In order to get the default option, type
ddmoptions = multiestv4();
ddmoptions is a Matlab structure containing input parameters for DMAT. You can change them and then run the model
ddmoutput = multiestv4(data, ddmoptions);
You can specify multiple models ddmoptions(1), ddmoptions(2), etc. These will then be fitted one-by-one, and the outputs will appear in the output structure as ddmoutput(1), ddmoutput(2), etc. Unforunately, multiestv4 applied to several model invokes the programme "runqueue", which will use the fitted model parameters for one model as starting points for the fit of the next - this may not be what you want. If you want to be sure that models are fitted independently of each other (and the results doesn't depend on the sequence of your models), then you should fit each model with a separate call to multiestv4().
See the appendices of the "primer to DMAT" for examples.
Using Design Matrices
Assume you want to get different drift rates for each of your subjects, but all other parameters should be kept constant across subjects. By default, all parameters will be kept constant. You can deal with this type of problem very flexibly specifying design matrices for each parameter. Let assume we only have 3 subjects. In the case where drift rate is constant across subjects (the default), the design matrix is just a vector
[1 1 1]
. This means that only one parameter is needed to fit this vector to the data - the drift rate which is common to all subjects.
Letting drift rate vary across subjects means that we will obtain 3 separate drift rates, one for each subject. We are therefore fitting a model to the data which consists of three vectors, each representing a single subject. These vectors are the columns of the design matrix
[1 0 0 0 1 0 0 0 1] which is the identity matrix. You can think of this as a linear regression model 'y=Db', where 'y' are the data (3 subjects), 'D' is the design matrix (3-by-3 identity matrix above), and 'b' contains the 3 drift rates for each subject that we want to fit.