Edited version of original


EZ2: An extension of the EZ-diffusion model for Response Time and Accuracy

Yesterday, I submitted a paper to the Journal of Mathematical Psychology. In the paper I promised to have an R package available for download from the internet. Here it is. (A version that is installable on Mac OS X with the package installer option 'Local Source Package' is here.) As an alternative to ex-Gauss modeling of response times, this code fits diffusions that model the way information accumulation takes place in the brain (or at least, that's what we think).

For Windows users, you may need to install it with the rcmd command line utility, but you would have to have Perl installed. I'm trying to make it available as a regular zip file soon. (added: here it is.) Meanwhile you might simply try this source file which comes without documentation.

Ahum... the package itself is hardly documented at this point. The documentation essentially boils down to the following:

## create some data (theoretical values, not simulated)
# clearly, you would like to fit real data!
A = seq(.08,.13,len=6)
X2 = data.frame(A=A)
X2$vrt0 = sapply(A, function(a) EZ2.vrt(.1,.05,a))
X2$pe0 = sapply(A, function(a) EZ2.pe(.1,.05,a))
X2$vrt1 = sapply(A, function(a) EZ2.vrt(.2,a-.05,a))
X2$pe1 = sapply(A, function(a) EZ2.pe(.2,a-.05,a))

X2 = as.data.frame(X2)

# now pretend that X2 is the data frame that you have computed from real data

## fit an EZ2 model on each row
# method 1:
vrt0 ~ EZ2.vrt(v0,z,a),
pe0 ~ EZ2.pe(v0,z,a),
vrt1 ~ EZ2.vrt(v1,a-z,a),
pe1 ~ EZ2.pe(v1, a-z, a), data=X2)

# method 2 (eventually less typing):
mdl <- list( vrt0 ~ EZ2.vrt(v0,z,a),
pe0 ~ EZ2.pe(v0,z,a),
vrt1 ~ EZ2.vrt(v1,a-z,a),
pe1 ~ EZ2.pe(v1, a-z, a)
EZ2batch(c(v0=.11,v1=.21,z=.05,a=.09), mdl, data=X2)

Obtaining the package

Running following command on the console should also install the package

install.packages("EZ2", repos="http://R-Forge.R-project.org")

If not, and you get an error saying the package in not available for R version so and so, update your R installation and try again, or try the following command on the console (at least on Mac and Linux):

(Change the _1.0 to reflect the most up to date version on R-Forge.)

If this all fails, the package can be downloaded from R-Forge: A binary .zip for Windows, and a .tar.gz for Linux/Mac.

You may also want to try the webapplication. Way more difficult I think, but with a graphical user interface.