```___________________________________________________________________________________________________________________

___________________________________________________________________________________________________________________

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

Millisecond Software thanks Karolin Gieseler for her help with this script!

___________________________________________________________________________________________________________________
BACKGROUND INFO
___________________________________________________________________________________________________________________
This script implements the Math Effort Task based on:

Engle-Friedman, M., Riela, S., Golan, R., Ventuneac, A. M., Davis, C. M., Jefferson, A. D. and Major, D. (2003).
The effect of sleep loss on next day effort. Journal of Sleep Research, 12: 113–124.
doi:10.1046/j.1365-2869.2003.00351.x

___________________________________________________________________________________________________________________
___________________________________________________________________________________________________________________
Participants work through 100 addition problems. Each problem consists of 4 numbers
(default; possible range: 2-5 digits) that are flashed onto the screen one-by-one and participants
Once the last number is erased, a textbox is provided to collect the participants' responses.
The max duration for this sequence (start of number presentation to clicking the submit button)
is ~15s by default (for 4 numbers).

The numbers for each problem are selected randomly but differ in their level of difficulty.
Level 1: numbers are randomly selected from 1-3
Level 2: numbers are randomly selected from 3–9;
Level 3: numbers are randomly selected from 7–15;
Level 4: numbers are randomly selected from 7–25;
Level 5: numbers are randomly selected from 7–35.

The level of difficulty is under the participant's control. By default, participants select
a level of difficulty for a batch of 5 problems. Nevertheless, after each problem they get
the option to change their selection of difficulty. Once changed, the new level again applies to the
next 5 problems by default.

No feedback is provided during the task but the program keeps track of performance and
calculates a final performance score that weighs the number of correct solutions by
the problems' respective levels of difficulty.

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

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

(1) Raw data file: 'mathefforttask_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

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.nrDigits:					stores the number of digits presented (possible range: 2-5)
values.countTotalTrials:			tally of the number of test problems run
values.currentLevel:				stores the level of difficulty of the current problem
values.countTrialsCurrentLevel:		tally of the number of trials run in the current batch
values.number1:						stores the number selected for number1 (random selection)
values.number2:						stores the number selected for number2 (random selection)

values.number3:						stores the number selected for number3 (random selection)
Note: if fewer than 3 digits are presented, number3 = 0

values.number4:						stores the number selected for number4 (random selection)
Note: if fewer than 4 digits are presented, number4 = 0

values.number5:						stores the number selected for number5 (random selection)
Note: if fewer than 5 digits are presented, number5 = 0

values.solution:					stores the correct solution to the current addition problem
values.currentResponse:				stores the response to the current addition problem
values.ACC:							1: correct response provided; 0 = otherwise
values.rt:							stores the latency of responding; measured from onset of textbox until "continue" button is pressed
values.changeLevel:					1 = participant opted to make a (potential) level change; 0 = otherwise
values.countLevelChange:			tallies the number of level changes
values.countLevel1:					tally of level 1 problems attempted
values.countcorrectLevel1:			tally of level 1 problems correctly solved
values.countLevel2:					tally of level 2 problems attempted
values.countcorrectLevel2:			tally of level 2 problems correctly solved
values.countLevel3:					tally of level 3 problems attempted
values.countcorrectLevel3:			tally of level 3 problems correctly solved
values.countLevel4:					tally of level 4 problems attempted
values.countcorrectLevel4:			tally of level 4 problems correctly solved
values.countLevel5:					tally of level 5 problems attempted
values.countcorrectLevel5:			tally of level 5 problems correctly solved

(2) Summary data file: 'mathefforttask_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.nrDigits:					stores the number of digits presented (possible range: 2-5)
values.countTotalTrials:			tally of the number of test problems run

expressions.METScore: 				final METScore, calculated by adjusting the number of correctly solved problems on each level by
the difficulty factor of that level:

difficulty factor for level 5 => 5/5 = 1
difficulty factor for level 4 => 4/5 = 0.8
difficulty factor for level 3 => 3/5 = 0.6
difficulty factor for level 2 => 2/5 = 0.4
difficulty factor for level 1 => 1/5 = 0.2

MES_score =
(correct solutions to level 5 problems x 1) +
(correct solutions to level 4 problems x 0.8) +
(correct solutions to level 3 problems x 0.6) +
(correct solutions to level 2 problems x 0.4) +
(correct solutions to level 1 problems x 0.2)

values.countLevelChange:			tallies the number of level changes
values.countLevel1:					tally of level 1 problems attempted
values.countcorrectLevel1:			tally of level 1 problems correctly solved
values.countLevel2:					tally of level 2 problems attempted
values.countcorrectLevel2:			tally of level 2 problems correctly solved
values.countLevel3:					tally of level 3 problems attempted
values.countcorrectLevel3:			tally of level 3 problems correctly solved
values.countLevel4:					tally of level 4 problems attempted
values.countcorrectLevel4:			tally of level 4 problems correctly solved
values.countLevel5:					tally of level 5 problems attempted
values.countcorrectLevel5:			tally of level 5 problems correctly solved

* separate data files: to change to one data file for all participants (on Inquisit Lab only), go to section

___________________________________________________________________________________________________________________
EXPERIMENTAL SET-UP
___________________________________________________________________________________________________________________

1. Intro Block with a demonstration of a problem taken from each of the five levels of difficulties.
2. Test Block: 100 trials (default)
- at the start of the test block, participants select the default level of difficulty that automatically
applies to the next 5 (default) problems UNLESS participant opts to change level sooner.
- numbers are selected randomly with replacement from the level-corresponding pools of numbers

Problem Sequence: Max duration: ~15s (default)
Start of Problem: Number1 (800ms)->
ISI (500ms) ->
Number2 (800ms)->
ISI (500ms) ->
Number3** (800ms)->
ISI (500ms) ->
Number4** (800ms)->
textbox* ->

*During the test, participants also receive a second question that allows them to change the level
of difficulty for the next question(s)
** Experimenter can set how many digits should be presented under section Editable Parameters

Number Selections:
Level 1: numbers are randomly selected from 1-3
Level 2: numbers are randomly selected from 3–9;
Level 3: numbers are randomly selected from 7–15;
Level 4: numbers are randomly selected from 7–25;
Level 5: numbers are randomly selected from 7–35.

Scoring Algorithm (suggested by Millisecond Software):
The number of correctly solved problems at each of the 5 levels are weighted by their level of difficulty
and summed up:
MES_score =
(correct solutions to level 5 problems x 1) +
(correct solutions to level 4 problems x 0.8) +
(correct solutions to level 3 problems x 0.6) +
(correct solutions to level 2 problems x 0.4) +
(correct solutions to level 1 problems x 0.2)

The highest possible score (with 100 test problems): 100

___________________________________________________________________________________________________________________
STIMULI
___________________________________________________________________________________________________________________
Number presented in Arial, black on white, in the middle of the screen.
Size is proportional to the canvas height (default: 15%, can be set under section Editable Parameters)

___________________________________________________________________________________________________________________
INSTRUCTIONS
___________________________________________________________________________________________________________________
instructions are not original to Engle-Friedman et al (2003).
They are provided by Millisecond Software and 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

The parameters you can change are:

/numberSize:			the size of the presented numbers proportional to the canvas height (default: 15%)

/numberDuration:		the time (in ms) that each number is visible (default: 800ms)
/ISI:					the interstimulus interval (white screen) that is presented after the first three numbers (default: 500ms)

/RW:					the max. Duration (in ms) the textbox is provided to submit the response.
Note: the max.trialduration (measured from onset of first number to removal of testbox):
default: 4700ms + 10300ms = 15000ms
4700ms => the duration of the number presentation sequence for 4 numbers (4700ms = 4*800 + 3*500)

/ITI:					the intertrial interval (the duration of the 'get ready') in ms (default: 1000ms)

/maxNrTrials:			the maximum number of test trials (default: 100)
/numberBatchedProblems:	the number of problems in a default problem batch (default: 5)

/presentFinalScore:		true (1): the final score is presented to the participant at the end of this script (default)
false (0): the final score is not presented to the participant at the end of this script

/numberOfDigits:		the number of digits that should be presented (possible range 2-5)
Note: numbers outside the possible range get automatically adjusted to be either 2 or 5
```