Introduction

This is just another version of the Stroop task. This code is easy translatable in another language. This specific version uses German colors (Rot, Grün, Blau, Weiss). This one does not work with "bitmaps", so they can be quickly edited and changed to any language.

The Stroop Task is one of the best known psychological experiments named after John Ridley Stroop. The Stroop phenomenon demonstrates that it is difficult to name the ink color of a color word if there is a mismatch between ink color and word. For example, the word GREEN printed in red ink. The wikipedia web site gives a good description of the effect.

Colin MacLeod’s (1991) review article in the influential psychological journal Psychological Bulletin is frequently cited when discussing the effect.

There are many variations on the basic effect using other stimuli than colored words.

It is easier to measure key presses than the time it takes to name a task; therefore, there are "manual" Stroop tasks in which you need to press colored keys.

About this implementation

  • The demo takes less than 2 minutes to complete.

  • The demo uses German color words. It is easy to translate the PsyToolkit script to other langueges, there are just a few obvious places to change the text.

  • The demo below requires button presses instead of just naming (as in the original study)

  • In the demo, there are only 40 trials. In a real experiment, you should use considerably more trials to have a more reliable measure of the Stroop effect.

  • At the end of the demo, you get feedback about your response times in the compatible and incompatible condition:

    • Compatible: The color of the word and the meaning is the same (e.g., GREEN)

    • Incompatible: The color of the word and the meaning is different (e.g., GREEN)

  • The Stroop effect is here reported as the average response time in incompatible trials minus compatible trials.

  • Note, you can show your response times and copy and paste them to a local file for your own data analysis.

Run the demo

Data output file

In PsyToolkit, the data output file is simply a textfile. The save line of the PsyToolkit experiment script determines what is being saved in the data output file. Typically, for each experimental trial, you would have exactly one line in your text file, and each number/word on that line gives you the information you need for your data analysis, such as the condition, response speed, and whether an error was made.

Meaning of the columns in the output datafile. You need this information for your data analysis.

Colum Meaning

1

block number (1=training, 2=real data)

2

Response time (milliseconds)

3

Status (1=correct, 2=wrong, 3=timeout)

4

name of the word (e.g., "RED")

5

color number of word meaning (1=red,2=green,3=blue,4=yellow)

6

congruent or incongruent

7

font color (1=red,2=green,3=blue,4=yellow)

PsyToolkit code

Click to expand the PsyToolkit script code (part of zip file below)
options
  background color grey

# table columns:
# 1) The word as shown on screen. You can change this to different languages
# 2) We use a number for colors, 1=red, 2=green, 3=blue, 4=white
# 3) 1=congruent (word meaning matches color). 2=incongruent (no match)
#
# NOTE: the textcolor (column 2) is the same as the required key

table stroop
  "ROT"    1 1 ## red
  "ROT"    1 2 ## red
  "GRÜN"   2 1 ## green
  "GRÜN"   2 2 ## green
  "BLAU"   3 1 ## blue
  "BLAU"   3 2 ## blue
  "WEISS"  4 1 ## white
  "WEISS"  4 2 ## white

fonts
  normal arial 20
  big arial 80

part what_should_be_pressed
    font normal
    if &textcolor == 1
      show text "Du solltest die R Taste gedrückt haben" 0 100
      show text "weil die Zeichenfarbe ROT war" 0 150
    fi
    if &textcolor == 2
      show text "Du solltest die G Taste gedrückt haben" 0 100
      show text "weil die Zeichenfarbe GRÜN war" 0 150
    fi
    if &textcolor == 3
      show text "Du solltest die B Taste gedrückt haben" 0 100
      show text "weil die Zeichenfarbe BLAU war" 0 150
    fi
    if &textcolor == 4
      show text "Du solltest die W Taste gedrückt haben" 0 100
      show text "weil die Zeichenfarbe WEIẞ war" 0 150
    fi

task stroop
  keys r g b w  ## you can change this to different buttons depending on language
  delay 500
  show rectangle 0 0 10 30
  show rectangle 0 0 30 10
  delay 200
  clear 1 2
  # ------------------------------------------------------
  # if it is congruent, textcolor is same as textname
  if @3 == 1
    set &textcolor @2
  fi
  # if it is incongruent, textcolor is different
  # choose a random textcolor other than @2 (its own color)
  if @3 == 2
    set &&colorrange 1 2 3 4
    set &&colorrange remove position @2
    set &textcolor &&colorrange use random
  fi
  #
  font big
  if &textcolor == 1
    show text @1 0 0 red
  fi
  if &textcolor == 2
    show text @1 0 0 green
  fi
  if &textcolor == 3
    show text @1 0 0 blue
  fi
  if &textcolor == 4
    show text @1 0 0 white
  fi
  ## the 5000 is the maximum time
  readkey &textcolor 5000
  clear -1
  if STATUS == CORRECT
    show text "Korrect"
    delay 500
    clear -1
  fi
  if STATUS == WRONG
    show text "Falsch"
    part what_should_be_pressed
    delay 5000
    clear screen
  fi
  if STATUS == TIMEOUT
    show text "Zu langsam"
    part what_should_be_pressed
    delay 5000
    clear screen
  fi
  delay 500
  save RT STATUS @1 @2 @3 &textcolor

task instruction
  keys space
  font normal
  text align left
  show text "In dieser Auggabe, mache folgendes:" -300 -250
  show text "Reagiere mit den Tasten R, G, B, oder W" -300 -200
  show text "auf die Farbe in der die Wörter geschrieben sind." -300 -150
  show text "Reagiere auf Wörter in Farbe ROT mit Taste R" -300 -100
  show text "Reagiere auf Wörter in Farbe GRÜN, mit Taste G" -300 -50
  show text "Reagiere auf Wörter in Farbe BLAU, mit Taste B" -300 0
  show text "Reagiere auf Wörter in Farbe WEISS, mit Taste W" -300 50
  show text "Drücke die Leertaste um weiter zu gehen" -300 150 yellow
  readkey 1 99999
  clear screen
  show text "Also:" -300 -250
  show text "Falls Du dieses Wort siehst" -300 -200
  show text "ROT" -300 -150 green
  show text "drückst Du die G Taste" -300 -100
  show text "denn die Farbe der Buchstaben ist GRÜN." -300 -50
  show text "Auch falls die Bedeutung des Wortes etwas anderes sagt," -300 0
  show text "sollst Du trotzdem auf die Farbe der Buchstaben reagieren." -300 50
  show text "Drücke die Leertaste um es auszuprobieren" -300 200 yellow
  readkey 1 99999

block instruction
  message "STROOP Aufgabe, drücke die Leertaste zum Anfangen"
  tasklist
    instruction 1
  end

block training
  message "Jetzt kannst Du es ausprobieren. Drücke die Leertaste."
  tasklist
    stroop 8
  end

block real
  message "Drücke die Leertaste um es jetzt noch besser zu machen"
  tasklist
    stroop 40 ## 8 * 5
  end
  message "Vielen Dank. Drücke die Leertaste."

Download

If you have a PsyToolkit account, you can upload the zipfile directly to your PsyToolkit account. Watch a video on how to do that. If you want to upload the zipfile into your PsyToolkit account, make sure the file is not automatically uncompressed (some browsers, especially Mac Safari, by default uncompress zip files). Read here how to easily deal with this.

Further reading

  • Stroop, J.R. (1935). Studies of interference in serial verbal reactions. Journal of Experimental Psychology, 18, 643-662. Read here on Classics in the history of psychology.

  • MacLeod, C.M. (1991). Half a century of research on the Stroop effect: An integrative review. Psychological Bulletin, 109, 163-203.