Return to the Alternating Serial Reaction Time Task page
___________________________________________________________________________________________________________________	

						   *ALTERNATING SERIAL REACTION TIME TASK (ASRT)*
						   with keyboard input
___________________________________________________________________________________________________________________
	
Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 02-03-2017
last updated:  03-11-2020 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 03-11-2020 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO 	
___________________________________________________________________________________________________________________	

This script implements an Alternating Serial Reaction Task (with 4 different response buttons) based on 

Howard, D.V. & Howard, J.H. (2004). Implicit Sequence Learning: Effects of Level of Structure,
Adult Age, and Extended Practice. Psychology and Aging, 19, 79–92.

___________________________________________________________________________________________________________________
TASK DESCRIPTION
___________________________________________________________________________________________________________________	
Participants are presented 4 gray boxes in 4 possible screen positions (1, 2, 3, 4 with 1 being the left most box)
and have to press  a spatially corresponding response button as fast as possible once one of the boxes turns red.
The boxes turn red in semi-random fashion:
a basic repeating pattern sequence (Example: 1, 3, 2, 4) is interweaved with
a random sequence.

Sequence: 1(Pattern), Random, 3 (Pattern), Random, 2 (Pattern), Random, 4 (Pattern), Random, 1 (Pattern), Random....etc
The number of random trials in between pattern trials is determined by parameters.lag:
lag = 2 => each pattern trial is followed by 1 random trial (every other trial is a pattern trial)
lag = 3 => each pattern trial is followed by 2 random trials etc. (every third trial is a pattern trial)

___________________________________________________________________________________________________________________	
DURATION 
___________________________________________________________________________________________________________________	
the default set-up of the script takes appr. 45 minutes to complete

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

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

build:								The specific Inquisit version used (the 'build') that was run
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
script.sessionid:					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.
									
values.sequence:					pattern sequence run

parameters.Lag:						sets the lag between patter trials (default: 2)
									lag1 = every trial is a pattern trial (p1, p2, p3, p4, p1....)
									lag2 = every other trial is a pattern trial (p1, r, p2, r, p3, r, p4, r, p1....)
									lag3 = every third trial is a pattern trial (p1, r, r, p2, r, r, p3, r, r, p4, r, r, p1....)
									
values.countTestBlocks:				counts the number of test blocks run
values.countPatternTrials:			counts the pattern trials in a block (resets for each test block)
values.countRandomTrials:			counts the random trials in a block (resets for each test block; excludes the start trials before the pattern is started)
values.countSequenceReps:			counts the number of pattern sequence reps in a block (does not count starter trials)
values.index:						helper variable to determine the next stim position 
values.position:					1, 2, 3, or 4 => screen position of the red stim (red box) from left to right
parameters.RSI:						Response Stimulus Interval in ms (interval between correct response and presentation of next stimulus) (default: 120ms)

response:							the FINAL trial response (scancodes of the -default- keys pressed)
										32: D
										33: F
										36: J
										37: K
									Note: script saves the final and -by design- correct response
									
correct:							the correctness of the INITIAL response (1 = correct; 0 = incorrect)
									Note: only correct responses advance to the next trial
									
latency: 							the response latency/reaction time (in ms); measured from onset of red box stimulus
									until the correct response was entered (error penalty included)

P = pattern trial
R = random trial

expressions.FeedbackACC:			overall proportion correct (pattern and random trials)
expressions.FeedbackRT:				overall (pattern and random trials) median response time of correct responses

list.accuracyP.mean:				proportion correct pattern trials in the current block (including currently run trial)
list.latenciesP.median:				median latency (in ms) of responding to pattern trials in the current block (including currently run trial)
list.accuracyR.mean:				proportion correct random trials in the current block (including currently run trial) 
list.latenciesR.median:				median latency (in ms) of responding to random trials in the current block (including currently run trial)

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

computer.platform:					the platform the script was run on (win/mac/ios/android)
script.startdate:					date script was run
script.starttime:					time script was started
script.subjectid:					assigned subject id number
script.groupid:						assigned group id number
script.sessionid:					assigned session id number
script.elapsedtime:					time it took to run script (in ms); measured from onset to offset of script
script.completed:					0 = script was not completed (prematurely aborted); 
									1 = script was completed (all conditions run)
									
values.sequence:					pattern sequence run

parameters.lag:						sets the lag between patter trials (default: 2)
									lag1 = every trial is a pattern trial (p1, p2, p3, p4, p1....)
									lag2 = every other trial is a pattern trial (p1, r, p2, r, p3, r, p4, r, p1....)
									lag3 = every third trial is a pattern trial (p1, r, r, p2, r, r, p3, r, r, p4, r, r, p1....)
										
values.countTestBlocks:				Test Block Counter										
										
Performance Data:
proportion correct measures the accuracy of the INITIAL response;
'latency correct' measures the response time until the correct response was made

P = pattern trial
R = random trial

expressions.ACC_P:					the mean of all block proportion corrects for pattern trials
expressions.RT_P:					the mean of all block median correct latencies (in ms) for pattern trials						

expressions.ACC_R:					the mean of all block proportion corrects for random trials (start trials excluded)
expressions.RT_R:					the mean of all block median correct latencies (in ms) for random trials (start trials excluded)	

and separately for each testblocks:
values.ACC1_P - values.ACC21_P:		proportion correct for Pattern trials (block1-21)
values.RT1_P - values.RT21_P:		median correct latency (in ms) for Pattern trials (block1-21)
values.ACC1_P - values.ACC21_R:		proportion correct for Random trials (block1-21)
values.RT1_P - values.RT21_R:		median correct latency (in ms) for Random trials (block1-21)
								
___________________________________________________________________________________________________________________	
EXPERIMENTAL SET-UP 
___________________________________________________________________________________________________________________	

*21 ASRT blocks that run
- 10 random position start trials (excluded from analysis)
- number of pattern repetitions (default: 10) x length of pattern sequence (default: 4) = 40 pattern trials
- number of random patterns = (parameters.lag - 1) * number of pattern trials (by default, with lag= 2: 40 random trials)
	
Each block starts with the presentation of 4 gray boxes for 120ms before the first box turns red.
Incorrect responses are recorded but response needs to be corrected for trial to terminate.
After a correct response, the next target is presented after a response-stimulus interval (default RSI is 120 ms; 
this can be edited under Editable Parameters). 

___________________________________________________________________________________________________________________	
STIMULI
___________________________________________________________________________________________________________________	
4 gray boxes - size and screen location can be edited under Editable Parameters.
Position of targets (box turning red) can be edited under section Editable Lists

___________________________________________________________________________________________________________________	
INSTRUCTIONS 
___________________________________________________________________________________________________________________	
are not original; edit 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:
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:

/lag:							sets the lag between patter trials (default: 2)
									lag1 = every trial is a pattern trial (p1, p2, p3, p4, p1....)
									lag2 = every other trial is a pattern trial (p1, r, p2, r, p3, r, p4, r, p1....)
									lag3 = every third trial is a pattern trial (p1, r, r, p2, r, r, p3, r, r, p4, r, r, p1....)	
									
/nrBlocks:						number of blocks run (default: 21)
								Note: default script provides summary variables for 21 blocks; if more should be run 
								add necessary values to VALUES and update block.ASRT under section BLOCK accordingly
								
/maxPatternRepetitions:			the maximum number of pattern repetitions per block (default: 10)
																
Interface:
/pos1_x:						the first horizonal box position from the left in canvas width percentages (0% at the far left of canvas - 100% far right of canvas)
/pos2_x:						the second horizonal box position from the left in canvas width percentages
/pos3_x:						the third horizonal box position from the left in canvas width percentages
/pos4_x:						the fourth horizonal box position from the left in canvas width percentages
/stimHeight:					height of the boxes in canvas height percentages (default: 5%)

Response Keys (from left to right):
/responsekey1:					the first response button ("D")
/responsekey2:					the second response button ("F")
/responsekey3:					the third response button ("J")
/responsekey4:					the fourth response button ("K")

Duration Paramters (in ms):
/RSI:							Response Stimulus Interval in ms (interval between correct response and presentation of next stimulus) (default: 120ms)
/breakDuration:					the duration of the breaks (in ms) in between test blocks (default: 30000)
/readyDuration:					duration (in ms) of getting ready trial (default: 5000ms)