The Stroop Experiment: A Journey into Cognitive Processes

What is the Stroop Effect?

The Stroop effect, named after John Ridley Stroop, is a phenomenon illustrating the interference in reaction time of a task. When confronted with a word describing a color printed in a conflicting color (for example, the word "red" printed in blue), individuals take longer to name the ink color and are more prone to errors than when the word matches the ink color.

This effect demonstrates the nature of automatic processing and sheds light on the cognitive mechanisms underlying attention and the interplay between conflicting information streams.

Experience the Stroop Effect Yourself

Delve into the world of cognitive interference by participating in an online version of the Stroop test. This experiment allows you to firsthand experience the challenges of the Stroop effect:

Underlying Code for the Demo

    
        var jsPsych = initJsPsych({
    on_finish: function() {
        jsPsych.data.displayData('csv');
    }
});


// the colours are also the words ....
var colours = ['red', 'green', 'blue', 'yellow'];

var n_trials = 15;

// returns a JavaScript object with { text: ...., colour: .... }
// using a random colour (text is the same as colour)
function congruent() {
    // pick a colour ....
    // (when we're only picking one, with/without replacement doesn't matter)
    var colour_list = jsPsych.randomization.sampleWithReplacement(colours,1);
    // this returns a list with one item, so we select the first (only) item
    return { text: colour_list[0], colour: colour_list[0], condition: 'congruent' };
}

// returns a JavaScript object with { text: ...., colour: .... }
// using a random colour (text is different to colour)
function incongruent() {
    // pick two colours without replacement (i.e. they will be different)
    var colour_list = jsPsych.randomization.sampleWithoutReplacement(colours,2);
    // this returns a list with two item, we select these out
    return { text: colour_list[0], colour: colour_list[1], condition: 'incongruent' };
}

// these are in HTML, so <br> means "line break"
var instructions = {
    type: jsPsychInstructions,
    pages: [
      "Welcome to the experiment.<br>Press Space to continue.",
      "In this experiment you will be presented with the words blue, red, yellow and green.<br>Press Space to continue.",
      "As soon as you see a new word, press its first letter.<br>For example, press the B key for blue.<br>Press Space to continue.",
      "Try to answer as quickly as you can!<br>Press Space to start the experiment.",
    ],
    key_forward: ' '
}

var fixation = {
    type: jsPsychHtmlKeyboardResponse,
    stimulus: '<p style="font-size:60px">+</p>',
    trial_duration: 500,
    response_ends_trial: false
};

// blank (ITI stands for "inter trial interval")
var iti = {
  type: jsPsychHtmlKeyboardResponse,
  stimulus: '',
  trial_duration: 250,
  response_ends_trial: false
}

var trials = [instructions];
// repeat this code n_trials times
for (var i=0; i<n_trials; i++) {
    var values;
    // Math.random returns a random number between 0 and 1. Use this to decide
    // whether the current trial is congruent or incongruent.
    if (Math.random() < 0.5) {
        values = congruent();
    } else {
        values = incongruent();
    }
    var trial = {
        type: jsPsychHtmlKeyboardResponse,
        stimulus: '<p style="font-size:60px;color: '+values.colour+'">'+values.text+'</p>',
        // 'choices' restricts the available responses for the participant
        choices: ['r','g','b','y'],
        data: values
    };
    trials.push(iti);
    trials.push(fixation);
    trials.push(trial);
}

jsPsych.run(trials);
    
    

Behind the Scenes: The Technology

The demo above was created using the jsPsych library—a powerful tool for building behavioral experiments in a web browser. This library provides a flexible framework for designing a wide variety of cognitive tests, making it a favorite among researchers and educators.

What's even more exciting is that this demo is hosted using Cognition. Cognition offers a seamless platform to create, run, and manage online experiments, relieving users of the complexities related to web hosting, data storage, and security.

Take the Next Step with Cognition

Inspired by what you've seen? Ready to dive into the world of online experiments? With Cognition, you can run and share your experiments online effortlessly. Whether you're a seasoned researcher or just curious about cognitive tests, Cognition is here to simplify the journey.