Introduction
This is just another version of the Stroop task. This code is easy translatable in another language. This specific version does not work with "bitmaps" at all, 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.
Translate into your own language
Watch this video how to do this.
About this implementation
-
The demo takes less than 5 minutes to complete.
-
The demo uses English 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 8 practise trials followed by 80 trials.
-
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 (for example, "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
"RED" 1 1 ## red congruent
"RED" 1 2 ## red incongruent
"GREEN" 2 1 ## green congruent
"GREEN" 2 2 ## green incongruent
"BLUE" 3 1 ## blue
"BLUE" 3 2 ## blue
"YELLOW" 4 1 ## yellow
"YELLOW" 4 2 ## yellow
fonts
normal arial 20
big arial 80
part what_should_be_pressed
font normal
if &textcolor == 1
show text "You should have pressed the R key" 0 100
show text "because the ink color of the word was RED" 0 150
fi
if &textcolor == 2
show text "You should have pressed the G key" 0 100
show text "because the ink colour of the word was GREEN" 0 150
fi
if &textcolor == 3
show text "You should have pressed the B key" 0 100
show text "because the ink colour of the word was BLUE" 0 150
fi
if &textcolor == 4
show text "You should have pressed the Y key" 0 100
show text "because the ink colour of the word was YELLOW" 0 150
fi
task stroop
keys r g b y ## you can change this to different buttons depending on language
delay 500
show rectangle 0 0 10 30 ## part of fixation point
show rectangle 0 0 30 10 ## part of fixation point
delay 200
clear 1 2
# ------------------------------------------------------
# if it is congruent, textcolor is same as textname
if @3 == 1
set &textcolor @2
else
# if it is incongruent, textcolor is different
# choose a random textcolor other than @2 (its own color)
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 yellow
fi
## the 5000 is the maximum time
readkey &textcolor 5000
clear -1
if STATUS == CORRECT
show text "Correct"
delay 500
clear -1
fi
if STATUS == WRONG
show text "Wrong key"
part what_should_be_pressed
delay 5000
clear screen
fi
if STATUS == TIMEOUT
show text "Too slow"
part what_should_be_pressed
delay 5000
clear screen
fi
delay 500
save BLOCKNUMBER RT STATUS @1 @2 @3 &textcolor
task instruction
keys space
font normal
text align left
show text "In this task, do the following." -300 -250
show text "Respond with the keys R, G, B, or Y" -300 -200
show text "to the ink (font) color of the words." -300 -150
show text "Respond to words in a RED font with the R" -300 -100
show text "Respond to words in a GREEN font with the G" -300 -50
show text "Respond to words in a BLUE font with the B" -300 0
show text "Respond to words in a YELLOW font with the Y" -300 50
show text "Press SPACE to continue" -300 150 yellow
readkey 1 99999
clear screen
show text "Thus:" -300 -250
show text "If you see the word" -300 -200
show text "RED" -300 -150 green
show text "you press the key G" -300 -100
show text "because the ink (font) color of the letters is GREEN." -300 -50
show text "Even when the meaning of the word says something else," -300 0
show text "you still need to respond to the color of the letters." -300 50
show text "Press space bar to try yourself" -300 200 yellow
readkey 1 99999
block instruction ## this is block number 1
message "STROOP task, press the SPACE bar to start"
task instruction 1
block training ## this is block number 2
message "Now try this yourself."
task stroop 8
block real ## this is block number 3
message "Now that you are trained, real data collection begins"
task stroop 80 ## 8 * 5
message "Well done"
feedback
text -350 0 "Your speed in correct trials"
set &StroopCon mean c2 ; select c1 == 3 && c6 == 1 && c3 == 1
set &StroopInc mean c2 ; select c1 == 3 && c6 == 2 && c3 == 1
set &StroopEffect expression &StroopInc - &StroopCon
text -350 50 &StroopCon ; prefix "congruent: " ; postfix " ms"
text -350 100 &StroopInc ; prefix "incongruent: " ; postfix " ms"
text -350 150 &StroopEffect ; prefix "Your Stroop effect is incongruent minus congruent: " ; postfix " ms"
text -350 200 "Press space key to end"
end
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.