User Manual: Inquisit Predictable Task Switching Task


___________________________________________________________________________________________________________________	

						*PREDICTABLE TASK SWITCHING TASK: alternating-runs paradigm*
___________________________________________________________________________________________________________________	


Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 11-14-2017
last updated:  03-02-2022 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 03-02-2022 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO 	
___________________________________________________________________________________________________________________	
This script implements a predictable alternating-runs paradigm switching task, an 
executive function task

The implemented procedure is based on:

Rogers, R. D., & Monsell, S. (1995). The costs of a predictable switch
between simple cognitive tasks. Journal of Experimental Psychology:
General, 124, 207–231.

___________________________________________________________________________________________________________________
TASK DESCRIPTION	
___________________________________________________________________________________________________________________
This task switching task uses two simple categorization tasks and predictably alternates btw.
the two by using a clockwise rotation of stimulus presentation in a 2x2 matrix as the predictable location cues:									  

A 2 x 2 matrix is presented on screen. A pair of characters (e.g. '2F') appears in one of the matrix fields.
For each new trial, the presented pair of characters moves in clockwise fashion to the next box,
so that it is always predictable where the next character pair will appear.
The task that needs to be performed depends on the box the character pair appears in (= location cue).

Two tasks:
Task A: letter task: "If one of the characters is a consonant press, key E. If one of the characters is a consonant, press key I"
Task B: digit task: "If one of the characters is an even digit press, key E. If one of the characters is an odd digit, press key I"

Each character pair consists of of a target character (depends on the target task) and a distractor character. The distractor character 
can come from the opposite task or from an unrelated set of characters.

Example:
Participant has to perform the letter task every time the character pair appears in the top quadrants of the matrix
and has to perform the digit task every time the character pair appears in the bottom quadrants of the matrix (this quadrant-task assignment
can be set by experimenter).
Letter Task: the character pair consists of of a target letter (e.g. 'G') and a distractor character, either a digit (e.g. '2') or an unrelated symbol (e.g. '#')
Digit Task: the character pair consists of of a target digit (e.g. '3') and a distractor character, either a letter (e.g. 'A') or an unrelated symbol (e.g. '%')

Because the presentation of the character pairs moves predictably in a clockwise fashion, every odd trial in this script 
is a 'switch task' trial and every even trial is a 'nonswitch task' trial.

___________________________________________________________________________________________________________________	
DURATION 
___________________________________________________________________________________________________________________	
the default set-up of the script takes appr.:

Practice: ~15minutes
Test: ~40minutes
_____________________
Total: ~55minutes

___________________________________________________________________________________________________________________	
DATA FILE INFORMATION 
___________________________________________________________________________________________________________________	
The default data stored in the data files are:

(1) Raw data file: 'taskswitching_raw*.iqdat' (a separate file for each participant)*

computer.platform:				the platform the script was run on (win/mac/ios/android)
date, time: 					date and time script was run 
subject, group: 				with the current subject/groupnumber
session:						with the current session id

blockcode, blocknum:			the name and number of the current block (built-in Inquisit variable)
trialcode, trialnum: 			the name and number of the currently recorded trial (built-in Inquisit variable)
									Note: trialnum is a built-in Inquisit variable; it counts all trials run; even those
									that do not store data to the data file such as feedback trials. Thus, trialnum 
									may not reflect the number of main trials run per block.
										
countPracticeBlocks:			practice block counter
countTestBlocks:				test block counter 										
																				
(parameter) conditionSequence:			stores the sequence order: C for crosstalk condition, N = non-crosstalk condition
										(Example: CCNN => block1-2: C; block3-4: N)
(parameter) quadrantTaskAssignmnent:								
										1 = top quadrants: letter task; bottom quadrants: digit task
										symbols appearing in quadrant 1 (top, left) and quadrant 2 (top, right) =>  do letter task,
										symbols appearing in quadrant 3 (bottom, right) and quadrant 4 (bottom, left) =>  do digit task
										
										2 = top quadrants: digit task; bottom quadrants: letter task
										symbols appearing in quadrant 1 (top, left) and quadrant 2 (top, right) =>  do digit task,
										symbols appearing in quadrant 3 (bottom, right) and quadrant 4 (bottom, left) =>  do letter task						
						
										3 = left quadrants: letter task; right quadrants: digit task
										symbols appearing in quadrant 1 (top, left) and quadrant 4 (bottom, left) =>  do letter task
										symbols appearing in quadrant 2 (top, left) and quadrant 3 (bottom, left) =>  do digit task
						
										4 = left quadrants: digit task; right quadrants: letter task
										symbols appearing in quadrant 1 (top, left) and quadrant 4 (bottom, left) =>  do digit task
										symbols appearing in quadrant 2 (top, left) and quadrant 3 (bottom, left) =>  do letter task										
									
congruentTasks:					stores the currently congruent tasks (based on key assignment)
								"consonant-even; vowel-odd" vs. "consonant-odd; vowel-even";									

switch:							0 = non-switch trial (even trials); 
								1 = switch trials (odd trials)
								
quadrant:						1 = top, left; 
								2 = top, right; 
								3 = bottom, right; 
								4 = bottom, left (clockwise)	
								
targetTask:						stores the task to be performed:  "letter task" vs. "digit task"
targetCategory:					CONSONANT vs. VOWEL vs. EVEN vs. ODD							

targetSymbol:					stores the current target symbol (either the target consonant, target vowel, target even number, target odd number)
distractorSymbol:				stores the current distractor symbol
targetPair:						stores the currently presented combined pair of target symbol and distractor symbol

congruence:						for cross talk condition: 
								1 = distractor symbol is a control symbol (no sharing of response keys); 
								2 = congruent (distractor and target symbol share the same response key); 
								3 = incongruent (distractor and target symbol have opposite response keys); 
								
stimulusitem:					the presented stimuli in order of trial presentation
response:						the participant's response (scancode of response buttons)
correct:						accuracy of response: 1 = correct response; 0 = otherwise
latency: 						the response latency (in ms); measured from: onset of symbol pair


(2) Summary data file: 'taskswitching_summary*.iqdat' (a separate file for each participant)*

inquisit.version:				Inquisit version run
computer.platform:				the platform the script was run on (win/mac/ios/android)
startDate:						date script was run
startTime:						time script was started
subjectid:						assigned subject id number
groupid:						assigned group id number
sessionid:						assigned session id number
elapsedTime:					time it took to run script (in ms); measured from onset to offset of script
completed:						0 = script was not completed (prematurely aborted); 
								1 = script was completed (all conditions run)		
								
congruentTasks:					stores the currently congruent tasks (based on key assignment)
								"consonant-even; vowel-odd" vs. "consonant-odd; vowel-even";							
								
(parameter) conditionSequence:			stores the sequence order: C for crosstalk condition, N = non-crosstalk condition
										(Example: CCNN => block1-2: C; block3-4: N)
(parameter) quadrantTaskAssignmnent:								
										1 = top quadrants: letter task; bottom quadrants: digit task
										symbols appearing in quadrant 1 (top, left) and quadrant 2 (top, right) =>  do letter task,
										symbols appearing in quadrant 3 (bottom, right) and quadrant 4 (bottom, left) =>  do digit task
										
										2 = top quadrants: digit task; bottom quadrants: letter task
										symbols appearing in quadrant 1 (top, left) and quadrant 2 (top, right) =>  do digit task,
										symbols appearing in quadrant 3 (bottom, right) and quadrant 4 (bottom, left) =>  do letter task						
						
										3 = left quadrants: letter task; right quadrants: digit task
										symbols appearing in quadrant 1 (top, left) and quadrant 4 (bottom, left) =>  do letter task
										symbols appearing in quadrant 2 (top, left) and quadrant 3 (bottom, left) =>  do digit task
						
										4 = left quadrants: digit task; right quadrants: letter task
										symbols appearing in quadrant 1 (top, left) and quadrant 4 (bottom, left) =>  do digit task
										symbols appearing in quadrant 2 (top, left) and quadrant 3 (bottom, left) =>  do letter task										
									

Note: trials with latencies < 100ms and trials with 'no responses' are EXCLUDED from the following summary data
(warm-up trials not included)

C = crosstalk condition (distractors can be sampled from opposite task) vs. 
N = non-crosstalk condition (distractors are always control characters such as '$')

count_switchC:				number of switch crosstalk trial responses qualified for summary variables
propCorrect_switchC:		proportion of correct switch trials in crosstalk condition 
count_nonswitchC:			number of nonswitch crosstalk trial responses qualified for summary variables
propCorrect_nonswitchC:		proportion of correct nonswitch trials in crosstalk condition 
ACC_SwitchCost_C:			accuracy switchcosts in crosstalk condition 
								(difference btw. proportion correct of switch trials and nonswitch trials)
								=> negative value: participants were less accurate on switch trials (there was an accuracy cost to switching )

meanRT_switchC:				mean latency of correctly responding to a switch trial in crosstalk condition
meanRT_nonswitchC:			mean latency of correctly responding to a nonswitch trial in crosstalk condition
RT_SwitchCost_C:			latency switchcosts in crosstalk condition 
								(difference btw. mean correct latency of switch trials and nonswitch trials)
								=> positive value: participants were slower on switch trials (there was a latency cost to switching)

count_switchN:				number of switch noncrosstalk trial responses qualified for summary variables
propCorrect_switchN:		proportion of correct switch trials in non-crosstalk condition condition 								
count_nonswitchN:			number of nonswitch noncrosstalk trial responses qualified for summary variables
propCorrect_nonswitchN:		proportion of correct nonswitch trials in non-crosstalk condition condition 
ACC_SwitchCost_N:			accuracy switchcosts in non-crosstalk condition condition 
								(difference btw. proportion correct of switch trials and nonswitch trials)
								=> negative value: participants were less accurate on switch trials (there was an accuracy cost to switching )

meanRT_switchN:				mean latency of correctly responding to a switch trial in non-crosstalk condition condition
meanRT_nonswitchN:			mean latency of correctly responding to a nonswitch trial in non-crosstalk condition condition
RT_SwitchCost_N:			latency switchcosts in non-crosstalk condition condition 
								(difference btw. mean correct latency of switch trials and nonswitch trials)
								=> positive value: participants were slower on switch trials  (there was a latency cost to switching)

propExcluded:				proportion excluded (from summary variables) trials across all test trials (excluded because of no responses or because latency < 100ms)


* separate data files: to change to one data file for all participants (on Inquisit Lab only), go to section
"DATA" and follow further instructions

___________________________________________________________________________________________________________________	
EXPERIMENTAL SET-UP 
___________________________________________________________________________________________________________________

(1) Extensive Practice of the key assignments for the Letter and Digit Tasks
* 16 blocks of practice, alternating btw. letter task and digit task (8 blocks each)
* each block presents 24 trials (= 16 blocks x 24 trials/block = 384 trials total)
* key reminders are presented on screen during the first 8 blocks only
* practice trials require a response correction to move on
* during practice, one box with a character pair appears on screen; there is no response deadline

(2) Test: the test session consists of C blocks and N blocks
C = crosstalk condition (distractors can be sampled from opposite task) vs. 
N = non-crosstalk condition (distractors are always control characters such as '$')

* each block runs 48 trials 
* by default, the script runs 8 C blocks, followed by 8 N blocks (total number of trials run: 16 blocks * 48 trials/block = 768 trials)
	=> parameters.conditionSequence = "CCCCCCCCNNNNNNNN" (sequence order can be edited under section Editable Parameters)
* quadrant-task Assignment see Editable Parameters (sets which quadrants are assigned to which task)


Block Information (each block runs 48 trials)
* Block Start: depending on values.quadrantTaskAssignment (1, 2, 3, 4) the first quadrant position is randomly determined (randomly WITH replacement)
(and with it the first task is randomly determined)

	Example: values.quadrantTaskAssignment = 1 (top quadrants = letter task; bottom quadrants = digit task)
		=> the first selected quadrant is randomly selected to be either 1 (top left), or 3 (bottom right)
			=> if start quadrant is 1: starting task is letter task
				=> task sequence: AABBAABBAABB...AABB
			=> if start quadrant is 3: starting task is digit task
				=> task sequence: BBAABBAABBAA...BBAA

* quadrant changes clockwise from one trial to the next: 1 = top left; 2 = top, right; 3 = bottom, right; 4 = bottom, left	
* the task to be performed (letter task vs. digit task) depends on the quadrant
	* if letter task: half the trials select consonants; half select vowels
	* if digit task: half the trials select even numbers; half select odd numbers
* consonants, vowels, even digits, odd digits, control symbols are selected randomly WITH replacement
(constraint: the same consonant (vowel, even digit, odd digit, control symbol) canNOT be selected during the next
drawing from the same list) 
* the placement in the pair presented ('7#' vs. '#7') is randomly determined


Crosstalk Condition (C): can run control characters, and characters from the opposite task as distractor items
=> 3 types of congruency possible

1: no congruence (control character)
2: congruent (distractor comes from opposite task but requires the same response button)
3: incongruent (distractor comes from opposite task AND requires the opposite response button)

	
C-warmup: 12 trials
* 6 switch trials (all odd trials; counting the first one as a switch trial); 6 non-switch trials (all even trials)
	=> 3 switch trials (non-switch trials) for letter task (same for digit task)
		=> 1 control switch trial, 1 congruent switch trial, 1 incongruent switch trial (same for non-switch trials)
		=> !!!type of congruence (control, congruent, incongruent) and switch type are balanced for CC conditions
	
* 6 letter task trials: half select'consonants'; half select 'vowels'
* 6 digit task trials: half select 'even digits'; half select 'odd digits'

C-Test: 36 trials
* 18 switch trials
	=> 9 switch trials (nonswitch trials) for letter task (same for digit task)
		=> letter task: 3 control switch trials, 3 congruent switch trials, 3 incongruent switch trials
		=> !!!type of congruence (control, congruent, incongruent) and switch type are balanced for CC conditions

* 18 letter task trials: half select 'consonants'; half select 'vowels'
* 18 digit task trials: half select 'even digits'; half select 'odd digits'


NON-Crosstalk Condition (N): the same as for C condition but with only control characters as distractors (no congruent, incongruent pairings)


Trial Information:
target pair presentation-> 
wait for response (response deadline: 5000ms) -> 
correct response/timeout: ITI of 150ms; incorrect response: ITI of 1500ms (with errorfeedback)

___________________________________________________________________________________________________________________	
STIMULI
___________________________________________________________________________________________________________________	
vowels: "A", "E", "I", "U" (see list.vowels under section Editable Stimuli)
consonants: "G", "K", "M", "R" (see list.consonants under section Editable Stimuli)
odd: "3", "5", "7", "9" (see list.odd under section Editable Stimuli)
even: "2", "4", "6", "8" (see list.even under section Editable Stimuli)
control: "#", "%", "@", "&" (see list.control under section Editable Stimuli)

___________________________________________________________________________________________________________________	
INSTRUCTIONS 
___________________________________________________________________________________________________________________	
provided by Millisecond Software - can be edited under section Editable Instructions

___________________________________________________________________________________________________________________	
EDITABLE CODE 
___________________________________________________________________________________________________________________	
check below for (relatively) easily editable parameters, stimuli, instructions etc. 
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code 
to further customize your experiment.

The parameters you can change are:

/conditionSequence:		stores the sequence order: C for crosstalk condition, N = non-crosstalk condition
						(Example: CCCCCCCCNNNNNNNN - each block runs 48 trials)
/quadrantTaskAssignmnent:		
						1 = top quadrants:letter task; bottom quadrants: digit task
							symbols appearing in quadrant 1 (top, left) and quadrant 2 (top, right) =>  do letter task,
							symbols appearing in quadrant 3 (bottom, right) and quadrant 4 (bottom, left) =>  do digit task
						2 = top quadrants: digit task; bottom quadrants: letter task
							symbols appearing in quadrant 1 (top, left) and quadrant 2 (top, right) =>  do digit task,
							symbols appearing in quadrant 3 (bottom, right) and quadrant 4 (bottom, left) =>  do letter task						
						
						3 = left quadrants: letter task; right quadrants: digit task
							symbols appearing in quadrant 1 (top, left) and quadrant 4 (bottom, left) =>  do letter task
							symbols appearing in quadrant 2 (top, left) and quadrant 3 (bottom, left) =>  do digit task
						
						4 = left quadrants: digit task; right quadrants: letter task
							symbols appearing in quadrant 1 (top, left) and quadrant 4 (bottom, left) =>  do digit task
							symbols appearing in quadrant 2 (top, left) and quadrant 3 (bottom, left) =>  do letter task	
							
						
/maxPracticeBlocks:		the number of practice blocks run 
						Notes:
						* number should be evenshould be even to allow for the same number of Letter as Digit Tasks practice blocks
						* minimum number is 4 (if smaller, practice is skipped altogether)
						
Key Assignments:
/leftKey:				the left response button (default: "E")
/rightKey:				the right response button (default: "I")

/consonantKey:			the key assigned for consonants (default: parameters.leftKey)
/vowelKey:				the key assigned for vowels (default: parameters.rightKey)

/evenKey:				the key assigned for even digits (default: parameters.leftKey)
/oddKey:				the key assigned for odd digits (default: parameters.rightKey)
Note: the default assignments align consonants and even digits/vowels and odd digits

Stimuli Sizing
/quadrantSize:			the size of one of the box quadrants proportional to canvas height (default: 25%)
/targetSize:			the height of the symbol pairs proportional to canvas height (default: 5%)

Timing Parameters:
/readyDuration:			the duration (in ms) of the 'get-ready' trial (default: 2000ms)
/responseDeadline:		the amount of time (in ms) assigned for making a response during the test (default: 5000ms)
/correctITI:			the duration (in ms) of the intertrial interval if response was correct (default: 150ms)
/errorITI:				the duration (in ms) of the intertrial interval if response was incorrect (default: 1500ms)
/blockstartDuration:	the duration (in ms) of the highlighted box at the start of a new block (default: 2000ms)

For Summary Variables
/minRT:					trials in which participant respond with latency < minRT are excluded from summary variables (default: 100ms)