Return to the Rapid Reaching Task page
___________________________________________________________________________________________________________________	

										*Rapid Reaching Task*
___________________________________________________________________________________________________________________	

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 12-11-2019
last updated: 04-13-2021 by K.Borchert (katjab@millisecond.com) for Millisecond Software LLC

Script Copyright © 04-13-2021 Millisecond Software
___________________________________________________________________________________________________________________
BACKGROUND INFO 	
___________________________________________________________________________________________________________________	

This script implements a version of the Rapid Reaching Task for children - a task to study 
children’s risk-taking in everyday visuomotor situations  when wrong choices could be costly -
inspired by the published paradigm by Dekker et al (2016).

The script was originally written for and generously shared with the Millisecond library by Dr. Sara Haas.

Reference:
Dekker TM, Nardini M. Risky visuomotor choices during rapid reaching in childhood. 
Dev Sci. 2016;19(3):427–439. doi:10.1111/desc.12322

___________________________________________________________________________________________________________________
TASK DECRIPTION	
___________________________________________________________________________________________________________________	

Participants click/touch a Start button that lies below a fixed frame. Soon after touching down on the
Start button two overlapping circles, a green circle and a (e.g.) blue circle, appear in the frame.
Participants have to release the Start button and click/touch the area within the green circle 
as fast as they can without landing in the area of the penalty area (e.g. the blue circle).
Different costs for touching the penalty circle as well as outside the green circle are tested.
__________________________________________________________________________________________________________________	
DATA FILE INFORMATION 
___________________________________________________________________________________________________________________		
The default data stored in the data files are:

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

build:							Inquisit build
computer.platform:				the platform the script was run on
date, time, subject, group:		date and time script was run with the current subject/groupnumber 
blockcode, blocknum:			the name and number of the current block
trialcode, trialnum: 			the name and number of the currently recorded trial
									(Note: not all trials that are run might record data) 
									
/blockCounter_perphase:			tracks the number of blocks run during the current phase
/trialCounter_block:			tracks the number of trials run during the current block								
									

/phase:							"training" vs. "test"
/timeOut:						the timeOut (in ms) for the current trial

/penaltyDisplacementCondition:	1 = small displacement btw. target circle and penalty ('near'); 
								2 = far displacement btw. target circle and penalty
								
/penaltyPointsCondition:		1 = low penalty point condition; 2 = high penalty point condition								
								
/penaltyPoints:					the currently assigned penalty points if participant touches penalty area								
								
/selectPenaltyStim:				stores the itemnumber of the stimulus used for the penalty circle in the current trial
								1 = blue (low penalty condition); 2 = yellow (high penalty condition); 3 = gray (training)
										
response:						the participant's response (will be generic such as "lbuttondown"; 0 = noresponse)
mouse.x:						the horizontal screen coordinate of the response (not valid for no responses)
mouse.y:						the vertical screen coordinate of the response (not valid for no responses)

/responseRegion:				stores the response region:
									target only (= within the green circle only)
									target-penalty overlap (= within the overlap of green circle and penalty circle)
									penalty only (=within the penalty circle only)
									miss (= somewhere else on the screen)
									NR = no response	
								
/correct:						1 = participant touched target area only; 
								0 = any other response

/targetOnset_scriptelapsedtime:			stores the script.elapsedtime at time of target appearance
/startButtonLiftOff_scriptelapsedtime:	stores the script.elapsedtime at time of start-button lift-off
/responseTime_scriptelapsedtime:		stores the script.elapsedtime at time of touch response

/rt_TargetOnset: the difference (in ms) in the script.elapsedtime of the response and target onset
=> time it took after target onset to respond by touching the screen

/rt_LiftOffStartButton: the difference (in ms) in the script.elapsedtime of the response and lift-off of the start button
=> time it took after lifting figer off the start button to respond by touching the screen

/redoCounter:				counts the number of times during the test that a trial sequence had to restart
							due to a premature lift-off the Start button or a lift-off within 100ms of 
							target onset (considered a anticipatory response)
							
/trialPoints:				stores the trial points earned (or lost) during the current trial							
/totalPoints:				stores the total points earned
							
/timeOutCounter:				tracks the number of times a participant did not respond within the time limit within the current block
								(resets for each block)


/xCenter_inpx:					horizontal x-coordinate in screen pixels
/yCenter_inpx:					vertical y-coordinate in screen pixels

/xTarget_inpx:					stores the horizontal position of the target in pixels
/yTarget_inpx:					stores the vertical position of the target in pixels
/xPenalty_inpx:					stores the horizontal position of the penalty circle in pixels
/yPenalty_inpx:					stores the vertical position of the penalty circle in pixels

/targetRadius_inpx: 			the radius of the target (image)in screen pixels
/responseDistance_Target_inpx:	the calculated distance (in pixels) btw. mouse/touch response and center of target circle
/responseDistance_Penalty_inpx:	the calculated distance (in pixels) btw. mouse/touch response and center of penalty circle
/responseDistance_Target_inmm:	the mm-distance of mouse response and center of target circle
/responseDistance_Penalty_inmm:	the mm-distance of mouse response and center of penalty circle



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

script.startdate:				date script was run
script.starttime:				time script was started
script.subjectid:				subject id number
script.groupid: 				group id
script.elapsedtime:				time it took to run script (in ms)
computer.platform:				the platform the script was run on
/completed:						0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run)


/timeOut:						the time out (in ms) used during the test

/propCorrect:					proportion correct test trials
/meanRT:						mean response time (in ms) of touching the screen; measured from target onset
/meanCorrRT:					mean response time (in ms) of touching the target area only; measured from target onset
/meanTargetDistance_inpx:		mean distance btw. response coordinate and center of target (measured in screen pixels)
/meanTargetDistance_inmm:		mean distance btw. response coordinate and center of target (converted to mm)
/timeOutCounter:				the number of times participant did not respond in time during the test phase

+ summary data by training/low penalty blocks/high penalty blocks



* 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) Demo Phase: 20 trials
=> The Demo Phase runs 20 trials with no time limits and additional text reminders on screen
=> the penalty circle is gray (hitting the penalty circle does not result in negative feedback)
=> hitting the green circle results in a point (but the point does not count towards count of total points)

(2) Training Phase: 15 blocks of 20 trials each
=> the Training phase starts with a time limit of 1000s
=> at the end of each training block it is checked whether performance is better or at 90% correct
AND participant has not timed out during any of the trials. In this case, the timeout gets adjusted down:
	- the first adjustment will delete 100ms
	- any subsequent adjustments will delete 50ms
=> the penalty circle is gray (hitting the penalty circle does not result in negative feedback)
=> hitting the green circle results in a point (but the point does not count towards total points)
=> the last two training blocks are run with the final test timeout (by default - editable parameter)

(3) Test Phase: 10 blocks of 20 trials

a) low penalty blocks: 5 blocks (color of penalty circle is blue; penalty => 1 point deduction)
b) high penalty blocks: 5 blocks (color of penalty circle is yellow; penalty => 5 point deduction)
=> order of low/high penalty blocks is counterbalanced by assigned groupnumber
	=> odd groupnumbers run: low penalty -> high penalty
	=> even groupnumbers run: high penalty -> low penalty
	
No Response Penalty: a no response penalty results in deduction of 7 points and a delay of the next trial of 20s
Misses Penalty: clicking/touching anywhere else on the screen does not result in deduction or winning of points


General TrialSequence:

1. Start: fixation cross + Start Button

2. Display: as soon as the start button is pressed down, the fixation frame appears
=> 500ms later the target circle/penalty circle display is presented
(if participant lifts the mouse button/finger of the start button before the display appears or
within 100ms of display presentation, the trial sequence is aborted and a new one is started.
The trial sequence is further aborted if the mouse/finger is moved off the Start Button before the
target display appears.)

3. Response: participants are asked to touch/click on the green circle as fast as possible
within the current time limit

4. Response Feedback: the computer displays a turquoise X where the screen was clicked/touched
and presents the number of points won or lost during this trial
=> if only the green circle was pressed: + 1
=> if only the penalty circle was clicked: -1 or -5
=> if the overlap region was pressed: sum of reward/penalty points

5. TEST only: Reward Meter
A visual reward meter is presented 

6. Time out Delay: this trial is only run if a participant did not respond in time and has to wait
20sec for the next trial sequence


Distance Target/Penalty Circle:

this script varies the distance btw. target and penalty circle (within-factor):
two different conditions are run
near: center of penalty circle is 1 radius away from center of target circle
far: center of penalty circle is 1.5 radius away from center of target circle

The order within a block is randomly determined with the constraint that an equal number of each
condition is run within each block

Location Target/Penalty Circle:
The computer randomly jitters the x and y positions of the target circle within 31.5mm (based
on default measurements) of  the x and y center position of the fixation frame
(see expressions.maxTargetOffset_inmm)

Note: 
the default height of the fixation frame is 81mm
=> 40.4mm are available on the top and bottom of the center to display the target circle
=> target circle has a radius of 9mm (40.5 - 9 = 31.5mm)
=> the max. displacement for the target center is 31.5mm

Note: 
1. penalty circle is always to the right or left of target circle
2. it is randomly determined whether the penalty circle is presented to the left or the right of the
target circle


___________________________________________________________________________________________________________________	
STIMULI
___________________________________________________________________________________________________________________	
provided by Millisecond Software (not original) - can be edited under section Editable Stimuli

___________________________________________________________________________________________________________________	
INSTRUCTIONS 
___________________________________________________________________________________________________________________	
provided by Millisecond Software (not original) - 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:

User Interface Parameters:

/distance_ScreenCenterToFrameCenter_inmm:	 the distance (in mm) of the fixation frame center to the center of the screen (default: 0mm)
												Note: the center of the frame will always be at (default) or above the center of the screen
												
/fixationCrossHeight_inmm:					the height of the fixation cross in mm (default: 10mm)
/fixationFrameWidth_inmm:					the width of the fixation frame in mm (default: 115mm)
/fixationFrameHeight_inmm:					the height of the fixation frame in mm (default: 81mm)
/fixationFrameBorder_inmm:					the width of the fixation frame border in mm (default: 5mm)
/targetRadius_inmm:							the radius of target circle in mm (default: 9mm => diameter: 18mm)

/distance_FrameCenterToStartbutton_inmm:	the distance (in mm) of the center of the start button 
											to the center of the fixation frame (default: 70mm)
												Note: the start button will always be located at or below the center of the fixation frame
											
/StartButtonSize_inmm:						the size of the square Start button in mm (default: 15mm)


Experimental Design Parameters:

/penaltyDisplacementFactor1:		the 'close' displacement btw. target center and penalty circle center as a factor of the circle 
									radius (default: 1)
									=> center of penalty circle lies on target radius
									
/penaltyDisplacementFactor2:		the 'far' displacement btw. target center and penalty circle center as a factor of the circle 
									radius (default: 1.5)
									=> center of penalty circle lies outside the target radius

/targetPoints:						the number of points awarded for pressing the target circle (default: 1)
/penaltyPoints_low:					the number of points lost for pressing the penalty circle in the low penalty condition (default: 1)
/penaltyPoints_high:				the number of points lost for pressing the penalty circle in the high penalty condition (default: 5)
/missPenaltyPoints:					the number of points lost for pressing outside the target and/or penalty circle = miss (default: 0)
/timeoutPenaltyPoints:				the number of points lost for not responding in time (default: 7)

/timeoutDelayPenalty_inms_training:			the delay of the next trial after a timed-out response (default: 20s) during training
/timeoutDelayPenalty_inms_lowpenalty:		the delay of the next trial after a timed-out response (default: 20s) during low penalty
/timeoutDelayPenalty_inms_highpenalty:		the delay of the next trial after a timed-out response (default: 20s) during high penalty


/trials_perblock_demo:					number of demo trials per block (default: 20)
/trials_perblock_training:				number of training trials per block (default: 20)
/trials_perblock_lowpenalty:			number of low penalty trials per block (default: 20)
/trials_perblock_highpenalty:			number of high penalty trials per block (default: 20)

/number_timedTrainingBlocks:			number of timed training blocks (default: 15)
/numberOfTrainingBlocksToRunWithTestTimeout: by default the last two training blocks are run with the final test timeout

/number_highPenaltyBlocks:				number of high penalty blocks (default: 5)
/number_lowPenaltyBlocks:				number of low penalty blocks (default: 5)

/targetOnset_inms:					the time (in ms) btw. pressing on start-button and onset of target (default: 500ms)
/anticipatoryResponse_inms:			the time (in ms) after onset of target that is considered the timeframe for an anticipatory response (default: 100ms)