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) + "\r\n";
    } 

    // 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
    link.click();    
}


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


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");

main.setfontsize(60);
// Present some instructions, where 
gives a line-break text("You will see either a word or non-word appear in the middle of the screen
" + "Press the S-Key for a word or the L-key for a nonword

" + "Try to be as accurate and fast as possible

" + "The whole experiment takes about 6 min

" + "Put your left index finger on (above) the S-Key
" + "And put your right index finger on (above) the L-Key

" + "Start the experiment by pressing the space bar").align("left"); awaitkey(' '); // Wait until the space bar is pressed await(1000); text("Ready? First word will appear in 2000 ms").align("center"); await(2000); clear(); await(2000); 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)"); await(3000); --i; } else { if (contains(words,stimuli[i])) { rt_words += e.RT; if (e.key === 's') { // Corectly identified word ++correct; results.push([stimuli[i],e.RT,1,1,stimuli[i].length]); } else { results.push([stimuli[i],e.RT,0,1,stimuli[i].length]); } } else { rt_nonwords += e.RT; if (e.key === 'l') { // Correctly identified non-word ++correct; results.push([stimuli[i],e.RT,1,0,stimuli[i].length]); } else { results.push([stimuli[i],e.RT,0,0,stimuli[i].length]); } } } clear(); // Clear the screen await(1000); // Give 1000 ms pause } text("

Finished!

" + "You had " + correct + " correct responses (out of 180)
" + "Your mean RT to correct words was: " + (rt_words/90).toFixed(2) + "
" + "Your mean RT to correct nonwords was: " + (rt_nonwords/90).toFixed(2) + "

" + "Thank you for participating!

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
" + "Each row contains: word, reaction time, score correct (1)/incorrect (0), word (1)/nonword (0), word length

" + "Or press SPACE BAR again to finish and skip downloading"); var d = addblock("center",80,40,10).button("Download Data"); waitfor { d.await("click"); writefile(results); } or { awaitkey(' '); }
This experiment has no YouTube links
nonwords_lexical_decision_task.txt
words_lexical_decision_task.txt