Return to the Change Detection Task page
___________________________________________________________________________________________________________________	

											*Change Detection Task*
___________________________________________________________________________________________________________________	

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 11-25-2020
last updated:  10-06-2021 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC

Script Copyright © 10-06-2021 Millisecond Software

___________________________________________________________________________________________________________________
BACKGROUND INFO 	
___________________________________________________________________________________________________________________	

This script implements a Change Detection Task, a measure of Visual Working Memory.
The implemented procedure is based on Harris et al (2020).

Reference:
Harris, A.M et al (2020). Behavioral and electrophysiological evidence for a dissociation between 
working memory capacity and feature-based attention. Cortex, 129, 158-174.
(Change Task Description: p.160-161)

___________________________________________________________________________________________________________________
TASK DESCRIPTION	
___________________________________________________________________________________________________________________	

Participants view short displays of 4/6/8 colorful squares that are followed by a single probe square
located in one of the display square's positions. Participants have to decide if the color of the probe
is the same or different than the color of the square that previously sat in the probe's location.

___________________________________________________________________________________________________________________	
DURATION 
___________________________________________________________________________________________________________________	
the default set-up of the script takes appr. 12 minutes to complete
___________________________________________________________________________________________________________________	
DATA FILE INFORMATION 
___________________________________________________________________________________________________________________		
The default data stored in the data files are:

(1) Raw data file: 'changedetectiontask_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
session:							with the current session id

//Design Parameters
/runFixedDesign = true				true (1) = the fixed design (with default trial lists -> default square positions/colors) will be run
									false (0) = the script will generate new lists (new square position/colors) during runtime at the start of the script

/useOnlyArrayColorsForProbe			true (1) = the color of the different probe is only sampled from the colors used in the preceding array
									false (0) = the color of the different probe is sampled from all 6 colors (that are not used for the target square)

/presentationSquareHeight			the proportional size of the 'invisible' gray presentation square relative to canvas height
									Note: the default squares are presented in an 'invisible' gray square of size 80%
									
/squareHeight						the proportional size of the array squares relative to canvas height
									Note: the default square locations were generated with 'squareHeight' = 15%	
									
/squareHeight_inmm:					the absolute size (in mm) of the presented array squares on the current monitor		



																		
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. 
										
/N:									the current number of squares presented (array size)
/index:								helper variable to select square positions/colors; default setting is by sequential selection

/trialtype:							1 = same (probe color is the same as the color of the square that was presented in the same location)
									2 = different (probe color is different from the color of the square that was presented in the same location)

response:							scancode of response button
									31 = S; 32 = D
									
/responseCategory:					'same' or 'different' 

correct:							1 = response was correct; 0 = response was incorrect 
latency:							response time in ms; measured from onset of probe

//the proportional square positions (horizontal: 0%(left)-100%(right); vertical: 0%(top) to 100%(bottom))
values.x1, values.y1, 
values.x2, values.y2,
values.x3, values.y3,
values.x4, values.y4,
values.x5, values.y5,
values.x6, values.y6,
values.x7, values.y7,
values.x8, values.y8,

//square colors
values.color1, values.color2, values.color3, values.color4,
values.color5, values.color6, values.color7, values.color8,

//probe:
/probe:								the square location that the probe occupies (for level4; 1-4; for level6: 1-6; for level8: 1-8)
/probe_x:							the horizontal coordinate of the probe (should match with coordinates of the square location that the probe occupies)
/probe_y:							the vertical coordinate of the probe (should match with coordinates of the square location that the probe occupies)
/probeColor:						the color of the probe


//Square Distance Check Variables: store the distances btw. the individual array squares
/buffer_inpx:						the square distance buffer in pixels 
/buffer_inmm:						the square distance buffer converted into mm

/squareDistanceCheck: 				1 = all array square distances >= expressions.minDist_inpx
									0 = at least one distance < expressions.minDist_inpx 
									(should not happen but in some cases rounding errors might lead to 'false positive' alerts.
									Squares might have overlapped if: pixel distance < (minDist_inpx-buffer_inpx) 
									
/overlapSuccess:					similar to expressions.squareDistanceCheck, but 
									pixel distance < (minDist_inpx-buffer_inpx)
									0 = overlap 
									1 = no overlap
																																										
/minDist_inpx:						the minimum distance (in pixel) that squares should be apart
/minDist_inmm:						the minimum distance (in mm) that the square should be be apart

/d12-d78:							the pixel distance between each presented square
									Example: d12 = pixel distance btw. center of square1 and center of square2
									
/minObservedSquareDistance_inpx:	minimum observed pixel distance of the squares 
/maxObservedSquareDistance_inpx:	maximum observed pixel distance of the squares
/minObservedSquareDistance_inmm:	minimum observed mm-distance of the squares 
/maxObservedSquareDistance_inmm:	maximum observed mm-distance of the squares									


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

inquisit.build:						the Inquisit build/version run
computer.platform:					the platform the script was run on (win/mac/ios/android)
inquisit.build:						the version/build of Inquisit
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)
									
/runFixedDesign = true				true (1) = the fixed design (with default trial lists -> default square positions/colors) will be run
									false (0) = the script will generate new lists (new square position/colors) during runtime at the start of the script

/useOnlyArrayColorsForProbe			true (1) = the color of the different probe is only sampled from the colors used in the preceding array
									false (0) = the color of the different probe is sampled from all 6 colors (that are not used for the target square)

/presentationSquareHeight			the proportional size of the 'invisible' gray presentation square relative to canvas height
									Note: the default squares are presented in an 'invisible' gray square of size 80%
									
/squareHeight						the proportional size of the array squares relative to canvas height
									Note: the default square locations were generated with 'squareHeight' = 15%	
									
/squareHeight_inmm:					the absolute size (in mm) of the presented array squares on the current monitor



//Performance Data:										
									
/propCorrect:						overall proportion correct (across all conditions)
/meanCorrRT:						mean response time (in ms) for correct responses; across all conditions

/K4:								K-score for level N trials calculated as = (N4_hitrate + N4_CRrate - 1)*4							 
/N4_hitrate:						the hitrate for level N signal (=same) trials (hit = correctly responding that color was the same ) 
/N4_hit_RT:							the response time (in ms) for hits 
/N4_CRrate:							the correct rejection rate for level N noise (=different) trials (CR = correctly responding that color was different) 
/N4_CR_RT:							the mean response time (in ms) for correct rejections

(same for level6 and level8 trials)

K_overall:							the unweighted mean of all three K-scores		
							
* 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 
___________________________________________________________________________________________________________________	

3 array sizes (4, 6, 8) are tested in a blocked design. 
- by default, all participants work from smallest (4) to largest (8) array size
- by default all trial configurations (square locations/color, probe location/color) within an array size 
are run in a fixed sequence* (see parameters.runFixedDesign under Editable Parameters)

Each level:
- 6 practice trials (fixed sequence) - half the trials present the probe in the same color
- 60 test trials (fixed sequence) - half the trials present the probe in the same color
- all trials provide feedback
- probe Position: the position of the probe is randomly selected
- Display Square Colors: the colors of the display squares are randomly selected (without replacement)
from 7 possible colors:  white, black, purple, green, red, blue, yellow 
(Note: for level8 trials, one randomly selected color is repeated) - see Harris et al (2020)
- Probe Color: the probe color for 'different' trials is either 
a) selected from the remaining 6 colors 
(in which case the probe can have colors not presented during the display for level4/6 trials)
b) selected from the remaining colors of the displayed squares (DEFAULT setting in this script, see Editable Parameters)

Trial Sequence:
- array presented for 150ms (editable parameter) in an 'invisible' gray square on a gray background
- gray screen alone presented for 900ms (editable parameters) - retention interval
- probe is presented until response 
- iti (blank gray screen) with feedback is presented for 500ms (editable parameters)


*Generation of default/fixed trial configurations:
The default fixed trial configurations were generated with square sizes of size 15% canvasheight
within a presentation square of 80% canvasheight size and a 'square buffer' of 2% of canvasheight

TIP: to generate a new fixed sequence, you can run this script once with parameter.runFixedDesign = false
and copy the randomly generated position/color data from the data file into the corresponding 
position/color lists under section LISTS
If needed:
-> you can change the size of the 'invisible' gray presentationsquare under Editable Parameters 
-> you can change the size of the display squares under Editable Parameters
(Note: the max square size is 15%; this script automatically downsizes greater sizes to 15%)
___________________________________________________________________________________________________________________
STIMULI
___________________________________________________________________________________________________________________

The stimuli in this script are presented with proportional sizing relative to the active canvas.
The active canvas determined for this script is the largest possible rectangle of width:height = 4:3
that can be found on the current monitor. For square sizing check section Editable Parameters below.

If absolute sizing is needed (stimuli should have the same absolute size across monitors), 
check section DEFAULTS for more information.
___________________________________________________________________________________________________________________	
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: