Lexical Decision Task Demo Experiment Run Experiment

Lexical Decision Task

Jaap Murre

Fairly complete implementation of a typical lexical decision task, which takes about 6 min. It is suitable for use in lectures, where the audience can do the task on a laptop (keyboard). Because keyboard responses are required, the task cannot be taken on a mobile phone. Mean reaction times to words and nonwords are reported at the end with total correct responses. Individual subjects can also download their own data in a format that can be imported into a spreadsheet, like Excel or Google Sheets.

If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.

It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.

The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.

function writefile(/*array of arrays*/rows,/*string*/separator,/*string*/filename) 
    separator = separator || ",";
    filename = filename || "data.csv";
    // Build CSV file (or tab-delimited...)
    var file = "data:text/csv;charset=utf-8,", i;
    for (i = 0; i < rows.length; i++) {
       file += rows[i].join(separator) + "

    // Write file with filename
    var link = document.createElement("a");
    link.setAttribute("href", encodeURI(file));
    link.setAttribute("download", filename);
    document.body.appendChild(link); // Required for FF

var words = getwords("words_lexical_decision_task.txt"),
    nonwords = getwords("nonwords_lexical_decision_task.txt"),
    rt_words = 0, rt_nonwords = 0, correct = 0,
    stimuli = [],
    results = [],

stimuli = stimuli.concat(words,nonwords); // Combine two arrays into one new one
stimuli = shuffle(stimuli);               // Randomize the word/non-word order

addblock(0,90,20,8).text("S = Word").style("color","grey");
addblock(80,90,20,8).text("L = Nonword").style("color","grey");

// Present some instructions, where <br> gives a line-break
text("You will see either a word or non-word appear in the middle of the screen <br>"
   + "Press the <b>S-Key</b> for a <b>word</b> or the <b>L-key</b> for a <b>nonword</b> <br><br>"
   + "Try to be as accurate and fast as possible <br><br>"
   + "The whole experiment takes about 6 min <br><br>"
   + "Put your left index finger on (above) the S-Key<br>"
   + "And put your right index finger on (above) the L-Key<br><br>"
   + "Start the experiment by pressing the space bar").align("left");
awaitkey(' ');                     // Wait until the space bar is pressed

text("Ready? First word will appear in 2000 ms").align("center");

for (i = 0; i < stimuli.length; ++i)
    text(stimuli[i],300);          // show a word or non-word at 300% size
    e = awaitkey('s,l',2000);      // Await s or l or 2 s time-out
    if (e.type === "timeout")
        text("Please, try to respond faster (within 2 seconds)");
    else {
        if (contains(words,stimuli[i])) 
            rt_words += e.RT;
            if (e.key === 's') { // Corectly identified word
            } else {
        } else {
            rt_nonwords += e.RT;
            if (e.key === 'l') { // Correctly identified non-word
            } else {
    clear();                     // Clear the screen
    await(1000);                   // Give 1000 ms pause

    + "You had " + correct + " correct responses (out of 180) <br>"
    + "Your mean RT to correct words was: " + (rt_words/90).toFixed(2) + "<br>"
    + "Your mean RT to correct nonwords was: " + (rt_nonwords/90).toFixed(2) + "<br><br>"
    + "Thank you for participating!<br><br>Press SPACE BAR for Download Page");
awaitkey(' ');

text("Click below to download the data in a format that can be imported into Excel or Google Sheets<br>"
   + "Each row contains: word, reaction time, score correct (1)/incorrect (0), word (1)/nonword (0), word length<br><br>"
   + "Or press SPACE BAR again to finish and skip downloading");
var d = addblock("center",80,40,10).button("Download Data");

waitfor {
} or {
    awaitkey(' ');

You can download the files as follows: Click on the file (link) and then right-click and choose Save as... from the menu. Some media files (e.g., sound) will have a download button for this purpose.