Introduction

The flanker task, also known as the Eriksen flanker task, was designed in the early 1970s by Eriksen and Eriksen. Like most of the paradigms in this library, it is popular and there are many variants of the original.

The basic effect is that when you need to respond to stimuli "flanked" by irrelevant stimuli, the irrelevant stimuli can still affect your response. There is a similarity between other paradigms in which this type of interference from an irrelevant stimulus or stimulus feature occurs (like the Stroop task or the Simon task).

About this implementation

The flanker task here is slightly different from the original flanker task from Eriksen and Eriksen (1974) for various practical reasons (this version is just a bit easier). For example, in the original study, the spacing between the letters was varied, and in addition to compatible an incompatible letters, there were neutral letters. Of course, you can extent the code to add those features of the original study.

In this task, you need to respond with the A or L key of your keyboard. This matches the original task’s left or right lever press (A and L are left and right on the keyboard, respectively).

I added a reminder. If people make a mistake, the "rules" are shown on screen.

If you use this experiment for a university project, I recommend to use at least 100 trials, rather than the 50 used here in this demonstration.

Run the demo

In this example, you will see 5 letters appear above the fixation point, but you must only respond to the central letter (which is above the fixation point). The letters X and C need to be responded to with the A button of your keyboard. The letters V and B need to be responded to with the L button of your keyboard. If there is a mismatch between the flanking letters their response and the response required by the central letter, we speak of a "incongruent" or "incompatible" condition.

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

stimulus text

2

1 = congruent ; 0 = incongruent

3

status (1=correct, 2=error, 3=too slow)

4

the response time (ms)

PsyToolkit code

Click to expand the PsyToolkit script code (part of zip file below)
options
  bitmapdir stimuli

bitmaps
  fix
  fixgreen
  fixred
  intro

fonts
  Small arial 18
  Large arial 40

table flankers
 "XXXXX" 1 1
 "XXCXX" 1 1
 "XXVXX" 0 2
 "XXBXX" 0 2
 "CCXCC" 1 1
 "CCCCC" 1 1
 "CCVCC" 0 2
 "CCBCC" 0 2
 "VVXVV" 0 1
 "VVCVV" 0 1
 "VVVVV" 1 2
 "VVBVV" 1 2
 "BBXBB" 0 1
 "BBCBB" 0 1
 "BBVBB" 1 2
 "BBBBB" 1 2

task flanker
  table flankers
  keys a l
  font Large
  show bitmap fix 0 25 # stimulus 1
  show text @1 0 -25 255 255 255 # stimulus 2
  readkey @3 2000
  if STATUS = CORRECT
    clear 1 2
    show bitmap fixgreen 0 25
    delay 150
    clear 3
    delay 150
    show bitmap fixgreen 0 25
    delay 150
    clear 4
 fi
 if STATUS = WRONG
    clear 1 2
    font Small
    show text "You pressed the wrong key." 0 -150 # stimulus 3 
    show text "If you see X or C in the middle, press the A key" 0 -100 # stimulus 3 
    show text "If you see V or B in the middle, press the L key" 0 -50 # stimulus 4
    set $counter 0
    while $counter < 15
      set $counter increase
      show bitmap fixred 0 25
      delay 100
      clear -1
      delay 100
    while-end
    clear 3 4 5 # clear the reminder
 fi
 if STATUS = TIMEOUT
    clear 1 2
    font Small
    show text "You responded to slowly. Respond within 2 seconds." 0 -150 # stimulus 3 
    show text "If you see X or C in the middle, press the A key" 0 -100 # stimulus 4
    show text "If you see V or B in the middle, press the L key" 0 -50 # stimulus 5
    set $counter 0
    while $counter < 15
      set $counter increase
      show bitmap fixred 0 25
      delay 100
      clear -1
      delay 100
    while-end
    clear 3 4 5 # clear the reminder
 fi
 delay 500 # intertrial interval
 save @1 @2 STATUS RT

message intro

block test
  task flanker 50
  feedback
    text align left
    text color yellow    
    set &RTCon mean c4 ; select c2 == 1 && c3 == 1 
    set &RTInc mean c4 ; select c2 == 0 && c3 == 1
    set &FlankerEffect expression &RTInc - &RTCon
    text -200 -100 "Average RT in conditions:"
    text -200  -25 &RTCon ; prefix "Compatible: "     ; postfix " ms"
    text -200   50 &RTInc ; prefix "Incompatible: "   ; postfix " ms"
    text -200  125 &FlankerEffect ; prefix "Flanker effect: " ; postfix " ms"
    text -200  200 "Press space bar to continue"
  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

  • Eriksen, B. A. & Eriksen, C. W. (1974). Effects of noise letters upon identification of a target letter in a non-search task. Perception and Psychophysics, 16, 143-149.