Introduction
Executive functions help a person to organise their thoughts. There are slightly different definitions of what executive function is. One well known contempory author on the topic is Sabine Doebel with whom PsyToolkit worked together to create an online version of the Dimensional Change Card Sort task (Doebel, Stucke, & Stoet, 2021). Dr. Doebel is well know for her work on the the study of children’s executive function (Doebel, 2020).
About this implementation
The DCCS is a "card" sorting task. In the task, children see a top card and two bottom cards. They need to match one of the bottom cards to the top card according to different rules in different halves of the experiment. The main aim of the DCCS is to measure how difficult it is to switch from the first to the second task. In adults, a similar cognitive ability can be measured with, for example, the task switching paradigm.
PsyToolkit lists different types of task-switching paradigms. Check it out in the overview of the experiment library. |
In this experiment designed for children as young as three years old, there is a lot of material spent on the explanation for the parents and participants.
It starts with an introduction where information is increasingly shown on a screen with underlying audio. This greatly helps young participants who will do this task with their parents.
There are two blocks simply for learning to press the correct keyboard button. There are also practise trials.
Run the demo
In this demo, you will get very detailed instructions. You need a keyboard. |
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. For each trial (there are 18 training trials and 225 "real" trials), there is one line with 6 numbers (columns).
You need this information for your data analysis.
Colum | Meaning |
---|---|
1 |
The trial number |
2 |
The name of the block |
3 |
The condition used from the conditions table |
4 |
The reaction time |
5 |
The status (1=correct, 2=wrong, 3=timeout) |
PsyToolkit code
Click to expand the PsyToolkit script code (part of zip file below)
## shape first version
## full feedback only in one practise trial
## otherwise no feedback
## fly in to whatever child chooses
## note, I indented "show" lines showing things simultaneously
## total trials: 29:
## intro_shape trial does not require as response but is trial 1
## at least 2 key learning trials
## 1 switch example
## at least 2 task learning trials
## 33 trials
options
bitmapdir stimuli
sounddir stimuli
set &ALLTODO 36 ## this can increase if training takes more than 2 trials
set &MAXRT 10000
bitmaps
i1_1
i1_2
i1_3
i1_4
i1_5
i1_6
instruction1
red_train red_train_s.png
blue_train blue_train_s.png
red_star red_star_s.png
blue_star blue_star_s.png
empty_square
whopressedkey
help_when_switching_to_color ### DIFFERENT
remember_go_fast
happy
fonts
arial 50
sounds
instruction1 instruction1.mp3 ## general start instruction
snd_card_appears snd_card_appears.mp3
snd_sorted snd_sorted.mp3
snd_completion snd_completion.mp3
trumpets trumpets.mp3
#-----------------------------basic sounds with "can you put it" after it
#sound_red_long sound_red.mp3 ### DIFFERENT
#sound_blue_long sound_blue.mp3 ### DIFFERENT
sound_train_long sound_train.mp3
sound_star_long sound_star.mp3
#-----------------------------shorted sound without that
sound_red sound_red_short.mp3
sound_blue sound_blue_short.mp3
sound_train sound_train_short.mp3
sound_star sound_star_short.mp3
#-----------------------------feedback sounds
feedback_yeah feedback_yeah.mp3
feedback_oh_oh feedback_oh_oh_no.mp3
#-----------------------------full feedback sounds
good_red good_red.mp3
good_train good_train.mp3
good_star good_star.mp3
wrong_red wrong_red.mp3
wrong_train wrong_train.mp3
wrong_star wrong_star.mp3
#-----------------------------instruction sounds for starting with color game
intro_color_game intro_color_game.mp3
reminder_color_game reminder_color_game.mp3
switch_to_shape_game switch_to_shape_game.mp3
#-----------------------------instruction sounds for starting with shape game
shape_instruction shape_instruction.mp3
reminder_shape_game reminder_shape_game.mp3
switch_to_color_game switch_to_color_game.mp3
#-----------------------------instructions for key learning
snd_press_a_key snd_press_a_key.mp3
snd_good_a_key snd_good_a_key.mp3
snd_wrong_a_key snd_wrong_a_key.mp3
snd_press_l_key snd_press_l_key.mp3
snd_good_l_key snd_good_l_key.mp3
snd_wrong_l_key snd_wrong_l_key.mp3
lets_try_another_one lets_try_another_one.mp3
#------------------------------other sounds
snd_for_real snd_for_real.mp3 ## now we go for real, go as fast as you can
snd_general_intro snd_general_intro.mp3 ## at start for caregivers
# snd_caregiver_end snd_caregiver_end.mp3 ## ask for keypresses given Y/N
table mytable
include table_shape_first.txt
table practisetable
include practise_table_shape.txt
######################################################################
## LEARN A AND L KEYS
table keylearningtable_a
"a" 1 snd_press_a_key snd_good_a_key snd_wrong_a_key
table keylearningtable_l
"l" 2 snd_press_l_key snd_good_l_key snd_wrong_l_key
part rest_of_keylearning_task
## show text TRIALCOUNT
## delay 1000
## clear -1
show background 255 255 255 ## 1
show progress TRIALCOUNT &ALLTODO
show bitmap empty_square -200 -150 ## 2
show bitmap empty_square 200 -150 ## 3
delay 1000
clear -1 -2
show bitmap empty_square 0 150 ## this makes the target stimulus bottom
set $bA show-counter ## $bA sets the number of stimulus flying in
show bitmap empty_square -200 -150 ## 2
show bitmap empty_square 200 -150 ## 3
sound @3
readkey @2 10000
silence @3
if STATUS == 1
set &mysuccesscount increase
sound @4
if KEY == 1
part animation_left
fi
if KEY == 2
part animation_right
fi
fi
if STATUS != 1
set &ALLTODO increase 2
set &mysuccesscount 0
sound @5
set $tmpW $bA
part wiggle
delay 500
fi
save TRIALCOUNT BLOCKNAME TABLEROW RT STATUS
delay 3000
if &mysuccesscount == 1
end tasklist
fi
task keylearning_a
keys a l
table keylearningtable_a
part rest_of_keylearning_task
task keylearning_l
keys a l
table keylearningtable_l
part rest_of_keylearning_task
######################################################################
## R: seq(-200,0,200/6) for 6 steps X-axis
## R: seq(150,-150,300/6) for 6 steps X-axis
## cbind( seq(-200,0,200/6),seq(-150,150,300/6) )
part animation_left ## lasts 1000 ms
relocate $bA -33 100
delay 200
relocate $bA -67 50
delay 200
relocate $bA -100 0
delay 200
relocate $bA -133 -50
delay 200
relocate $bA -167 -100
delay 200
clear $bA
part animation_right
relocate $bA 33 100
delay 200
relocate $bA 67 50
delay 200
relocate $bA 100 0
delay 200
relocate $bA 133 -50
delay 200
relocate $bA 167 -100
delay 200
clear $bA
part wiggle
set $tmpwiggle 0
while $tmpwiggle < 5
move $tmpW -10 0
delay 50
move $tmpW 20 0
delay 50
move $tmpW -20 0
delay 50
move $tmpW 20 0
delay 50
move $tmpW -10 0
set $tmpwiggle increase
while-end
task practisetrial_shape
keys a l
table practisetable
## show text TRIALCOUNT
## delay 1000
## clear -1
show background 255 255 255 ## 1
show progress TRIALCOUNT &ALLTODO
show bitmap @2 -200 -150 ## 2
show bitmap @3 200 -150 ## 3
delay 1000
sound @6
delay 1150
clear -1 -2
show bitmap @4 0 150 ## this makes the target stimulus bottom
set $bA show-counter ## $bA sets the number of stimulus flying in
show bitmap @2 -200 -150 ## 2
show bitmap @3 200 -150 ## 3
readkey @5 &MAXRT
silence @6
if STATUS == CORRECT
set &my_correct_counter increase
sound @7
# animation to left
if @5 == 1
part animation_left
fi
if @5 == 2
part animation_right
fi
fi
if STATUS == WRONG
set &my_correct_counter 0
set &ALLTODO increase 2
sound @8
set $tmpW $bA
part wiggle
# animation to left
if @5 == 1
part animation_left
fi
if @5 == 2
part animation_right
fi
fi
if STATUS == TIMEOUT
set &my_correct_counter 0
set &ALLTODO increase 2
clear $bA
fi
save TRIALCOUNT BLOCKNAME TABLEROW RT STATUS
if &my_correct_counter < 2
delay 3000
sound lets_try_another_one
delay 2000
fi
if &my_correct_counter == 2
delay 5000
end tasklist
fi
task cards
keys a l
table mytable
## choose trial (this makes trials go from 1 to 24 in order)
set $tmp &&mytrials remove first
tablerow $tmp
## show text TRIALCOUNT
## delay 1000
## clear -1
show background 255 255 255 ## 1
show progress TRIALCOUNT &ALLTODO
show bitmap @2 -200 -150 ## 2
show bitmap @3 200 -150 ## 3
# if &play_for_real == 1
# sound snd_for_real
# delay 4680
# set &play_for_real 0
# if
delay 1000
sound @6
delay 1150 ## duration of sound
clear -1 -2
show bitmap @4 0 150 ## this makes the target stimulus bottom
set $bA show-counter ## $bA sets the number of stimulus flying in
show bitmap @2 -200 -150 ## 2
show bitmap @3 200 -150 ## 3
readkey @5 &MAXRT
silence @6
if STATUS != TIMEOUT
sound snd_sorted
if KEY == 1
part animation_left
fi
if KEY == 2
part animation_right
fi
fi
if STATUS == TIMEOUT
clear $bA
fi
save TRIALCOUNT BLOCKNAME TABLEROW RT STATUS
######################################################################
## INTRO TASKS TO LEARN SHAPE OR COLOR TASK
table color_intro_table
1 red_train blue_star blue_train 1 sound_train good_train wrong_train
task intro_shape
table color_intro_table
keys a l
show background 255 255 255 ## 1
show progress TRIALCOUNT &ALLTODO
show bitmap @2 -200 -150 ## 2
show bitmap @3 200 -150 ## 3
sound shape_instruction
delay 6460
set $tmpW 3
part wiggle ## lasts 1000
delay 661
set $tmpW 4
part wiggle ## lasts 1000
###------------------------------- here is a train at 9286
delay 165
clear 3 4
show bitmap blue_train -200 150 ## 4
set $bA show-counter
show bitmap @2 -200 -150 ## 5
show bitmap @3 200 -150 ## 6
move $bA 40 0
delay 100
move $bA 40 0
delay 100
move $bA 40 0
delay 100
move $bA 40 0
delay 100
relocate $bA 0 150
delay 560
part animation_left ## lasts 1000
###------------------------------- here is a star at 12820
delay 1500
clear 5 6
show bitmap red_star 200 150
set $bA show-counter
show bitmap @2 -200 -150 ## 7
show bitmap @3 200 -150 ## 8
move $bA -40 0
delay 100
move $bA -40 0
delay 100
move $bA -40 0
delay 100
move $bA -40 0
delay 100
relocate $bA 0 150
delay 560
part animation_right
delay 2000
task switch_to_color
table color_intro_table
show background 255 255 255 ## 1
show progress TRIALCOUNT &ALLTODO ## 2
show bitmap @2 -200 -150 ## 3
show bitmap @3 200 -150 ## 4
sound switch_to_color_game
delay 12806
set $tmpW 3
part wiggle ## lasts 1000
delay 672
set $tmpW 4
part wiggle ## lasts 1000
delay 1066
set $tmpW 3
part wiggle ## lasts 1000
delay 544
set $tmpW 4
part wiggle ## lasts 1000
delay 1000
######################################################################
task who_pressed ## this is just at end for parent Y/N answer
keys y n
set $dummy 0
sound trumpets
show bitmap whopressedkey
readkey 1 60000
sound snd_sorted
save TRIALCOUNT BLOCKNAME $dummy RT KEY
task help_when_switching_task ## this is just at end for parent Y/N answer
keys y n
set $dummy 0
show bitmap help_when_switching_to_color
readkey 1 60000
sound snd_sorted
save TRIALCOUNT BLOCKNAME $dummy RT KEY
task introfilm
keys n m
sound instruction1
show bitmap i1_1
delay 7351
show bitmap i1_2
delay 6051
show bitmap i1_3
delay 6723
show bitmap i1_4
delay 7455
show bitmap i1_5
delay 8320
show bitmap i1_6
readkey 1 60000
silence instruction1
sound snd_sorted
if KEY == 1
end tasklist
fi
######################################################################
block generalintro
set &&mytrials range 1 24
tasklist
introfilm 10
end
block intro_learn_keys_a
set &mysuccesscount 0
tasklist
keylearning_a 10 repeat_on_error
end
block intro_learn_keys_l
set &mysuccesscount 0
tasklist
keylearning_l 10 repeat_on_error
end
block intro_shape
tasklist
intro_shape 1
end
block practise_block
tasklist
practisetrial_shape 10 fixed
end
block shape_block
# set &play_for_real 1 this will let cards play the for real sound once
bitmap remember_go_fast
sound snd_for_real
delay 6010
tasklist
cards 12
end
block intro_switch_color
sound snd_completion
bitmap happy
delay 2000
tasklist
switch_to_color 1
end
block colortask
tasklist
cards 12
end
#################################################
### now caregiver needs to press yes or no
block get_caregiver_block1
tasklist
who_pressed 1
end
block get_caregiver_block2
tasklist
help_when_switching_task 1
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
-
Doebel, S., Stucke, N., Stoet, G. (2022). Why is Children’s Time in Less-Structured Activities Associated with Executive Function? A Study of Children at Home During the COVID-19 Pandemic. Developmental Science, e13226. Link to publisher.
-
Doebel, S. (2020). Rethinking Executive Function and Its Development. Perspectives on Psychological Science. Open access link.