___________________________________________________________________________________________________________________ Mental Arithmetic Task ___________________________________________________________________________________________________________________ Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC Date: 04-04-2018 last updated: 06-10-2020 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC Script Copyright © 06-10-2020 Millisecond Software ___________________________________________________________________________________________________________________ BACKGROUND INFO ___________________________________________________________________________________________________________________ This script implements a Mental Arithmetic Task based on: KAHNEMAN D., TURSKY, B., SHAPIRO, D. & CRIDER, A. (1969). PUPILLARY, HEART RATE, AND SKIN RESISTANCE CHANGES DURING A MENTAL TASK. Journal of Experimental Psychology, 79, No. 1, 164-167. ___________________________________________________________________________________________________________________ TASK DESCRIPTION ___________________________________________________________________________________________________________________ Participants are presented series of 4 digits and are asked to mentally add* a number (0, 1, 2 or 3) to each digit. The new sequence is reported by entering the new digits in provided textboxes. The script can be altered to run either addition, subtraction or multiplication sequences as well as test any levels from 0-9. ___________________________________________________________________________________________________________________ DURATION ___________________________________________________________________________________________________________________ the default set-up of the script takes appr. 15 minutes to complete ___________________________________________________________________________________________________________________ DATA FILE INFORMATION ___________________________________________________________________________________________________________________ The default data stored in the data files are: (1) Raw data file: 'mentalarithmetictask_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. parameters.arithmeticProcedure: the math task to perform: choose from "add", "subtract", "multiply" (the default one is "add") values.trialcount: counts the trials in the practice/test block (resets after practice) values.level: the current level tested (default: 0, 1, 2, 3) values.digitSequence: the digits in the order presented (e.g. "3456") values.corrSolution: contains the correct solution for the current digit sequence values.currentResponse: contains the entered digits (in sequence) textbox.digit1response.response- textbox.digit4response.response: entered digits by textbox values.ACC: 1 = the entered solution is correct (correct digits and order); 0 = otherwise values.countCorrDigits: counts the number of correctly entered digits per trial values.RT: stores the latency (in ms); measured from onset of textboxes to pressing the submit-button values.count0: counts the number of level 0 test trials values.countcorrect0: counts the number of correct level 0 test trials values.count1: counts the number of level 1 test trials values.countcorrect1: counts the number of correct level 1 test trials values.count2: counts the number of level 2 test trials values.countcorrect2: counts the number of correct level 2 test trials values.count3: counts the number of level 3 test trials values.countcorrect3: counts the number of correct level 3 test trials The following variables will be empty for the default script set-up and could be removed from the data file: values.count4: counts the number of level 4 test trials (default settings: "not run") values.countcorrect4: counts the number of correct level 4 test trials values.count5: counts the number of level 5 test trials values.countcorrect5: counts the number of correct level 5 test trials values.count6: counts the number of level 6 test trials values.countcorrect6: counts the number of correct level 6 test trials values.count7: counts the number of level 7 test trials values.countcorrect7: counts the number of correct level 7 test trials values.count8: counts the number of level 8 test trials values.countcorrect8: counts the number of correct level 8 test trials values.count9: counts the number of level 9 test trials values.countcorrect9: counts the number of correct level 9 test trials (2) Summary data file: 'mentalarithmetictask_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) parameters.arithmeticProcedure: the math task to perform: choose from "add", "subtract", "multiply" (the default one is "add") values.levels: stores all the levels run (default setup: 0123) parameters.maxCorrectSolutions: the exit criteria: number of problems participants have to get correct at each tested levels to exit the script (default: 5) values.passedTest: 0 = test terminated because max. allowed time was up; 1 = otherwise (reached criteria for all levels tested) values.trialcount: number of test trials run values.count0: counts the number of level 0 test trials values.countcorrect0: counts the number of correct level 0 test trials values.count1: counts the number of level 1 test trials values.countcorrect1: counts the number of correct level 1 test trials values.count2: counts the number of level 2 test trials values.countcorrect2: counts the number of correct level 2 test trials values.count3: counts the number of level 3 test trials values.countcorrect3: counts the number of correct level 3 test trials The following variables will be empty for the default script set-up and could be removed from the data file: values.count4: counts the number of level 4 test trials (default settings: "not run") values.countcorrect4: counts the number of correct level 4 test trials values.count5: counts the number of level 5 test trials values.countcorrect5: counts the number of correct level 5 test trials values.count6: counts the number of level 6 test trials values.countcorrect6: counts the number of correct level 6 test trials values.count7: counts the number of level 7 test trials values.countcorrect7: counts the number of correct level 7 test trials values.count8: counts the number of level 8 test trials values.countcorrect8: counts the number of correct level 8 test trials values.count9: counts the number of level 9 test trials values.countcorrect9: counts the number of correct level 9 test trials * 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) Practice: * by default the practice session runs 8 trials (2 trials per levels 0, 1, 2, 3); levels randomly selected (change the number of trials under section Editable Parameters; change the levels tested under section Editable Lists) (2) Test: - the test runs random selections of levels 0-3 (Note: levels can be edited under section Editable Lists) - once a level reaches criteria (5 correct solutions -> see section Editable Parameters for possible edits), it is not further selected - the test ends once all levels reach criteria OR if the maximum allowed test time expires (default: 1h; see section Editable Parameters for possible edits) Sequence Selection: - each digit sequences randomly selects 4 different digits - the script ensures as much as possible (without noticeably slowing down the selection process) that each presented digit sequence during the practice and test session is unique. For a random selection of 4 digits from 10 possible digits (no repeats), there are 5040 possible unique sequences. The script resets the list of unique sequences after 1000 sequences have been provided (thus repeats are possible after each block of 1000 trials, but it's unlikely that 1000 sequences are going to be run) Default Trial Sequence (can be edited under section Editable Parameters): Get Ready (1000ms) -> blank (4000ms) -> task instructions (2000ms) -> blank (3000ms) -> 1. digit (1000ms) -> blank (0ms) -> 2. digit (1000ms) -> blank (0ms) -> 3. digit (1000ms) -> blank (0ms) -> 4. digit (1000ms) -> blank (1000ms) -> presentation of input-textboxes (max. 8000ms) -> feedback (optional for test): positive feedback: 200ms error feedback: until participants decides to continue -> ITI (blank screen for 1000ms) ___________________________________________________________________________________________________________________ STIMULI ___________________________________________________________________________________________________________________ digits: change size under section Editable Parameters ___________________________________________________________________________________________________________________ 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: /maxCorrectSolutions: the exit criteria: number of problems participants have to get correct at each level tested to exit the script (default: 5) /maxTestTime: the max duration (in ms) the test is running if exit-criteria is not met (default: 3600000ms = 1h) /testFeedback: true (1) = performance feedback is provided during the test after each trial (default) false (0) = performance feedback is not provided during the test /arithmeticProcedure: the math task to perform: choose from "add", "subtract", "multiply" (the default one is "add") /digitSize: the proportional sizing (to canvas height) of the presented digits (default: 8%) /readyDuration: the duration (in ms) of the the 'get Ready' trial (default: 1000ms) /delayTaskInstructions: the delay (in ms) of the task instructions (measured from onset of trial) (default: 5000ms) /taskInstructionDuration: the duration (in ms) of the task instructions (default: 2000ms) /digit1Delay: the delay (in ms) of the first digit (measured from onset of trial) (default: 10000ms) /digitDuration: the duration (in ms) of the digit presentation (default: 1000ms) /digit2Delay: the delay (in ms) of the second digit (measured from onset of trial) (default: 11000ms) /digit3Delay: the delay (in ms) of the third digit (measured from onset of trial) (default: 12000ms) /digit4Delay: the delay (in ms) of the fourth digit (measured from onset of trial) (default: 13000ms) /responseTimeout: the response timeout (in ms) (default: 8000ms) /recallDelay: the delay (in ms) of the recall textbox (measured from onset of 'get Ready') (default: 15000ms) Note: script checks delay settings and aborts if conflicting /feedbackDuration: duration (in ms) of positive feedback (default: 500) Note: errorfeedback is provided until participant is ready to move on /ITI: the intertrial interval in ms (default: 1000) ************************************************************************************************************** ************************************************************************************************************** EDITABLE PARAMETERS: change editable parameters here ************************************************************************************************************** ************************************************************************************************************** /maxCorrectSolutions = 5 /maxTestTime = 3600000 /testFeedback = true /arithmeticProcedure = "add" /numberPracticeTrials = 8 /digitSize = 8% /readyDuration = 1000 /delayTaskInstructions = 5000 /taskInstructionDuration = 2000 /digit1Delay = 10000 /digitDuration = 1000 /digit2Delay = 11000 /digit3Delay = 12000 /digit4Delay = 13000 /recallDelay = 15000 /responseTimeout = 8000 /ITI = 1000 /feedbackDuration = 500 ************************************************************************************************************** ************************************************************************************************************** EDITABLE INSTRUCTIONS: change instructions here ************************************************************************************************************** ************************************************************************************************************** / fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 1) / items = ("Welcome") / position = (50%, 10%) / fontstyle = ("Arial", 8%, true, false, false, false, 5, 1) / size = (80%, 10%) / vjustify = center / items = ("Four digits will be presented - one by one- in the middle of the screen. <%expressions.buttoninstruct1%> and report back the new sequence at the end.") / position = (50%, 50%) / fontstyle = ("Arial", 5%, true, false, false, false, 5, 1) / size = (85%, 80%) / vjustify = center / items = ("Example") / position = (50%, 10%) / fontstyle = ("Arial", 8%, true, false, false, false, 5, 1) / size = (80%, 10%) / vjustify = center / items = ("<%expressions.buttoninstruct2%>") / position = (50%, 25%) / fontstyle = ("Arial", 3%, true, false, false, false, 5, 1) / size = (80%, 80%) / vjustify = center / items = ("The correct solution therefore is: <%values.newdigit1%> <%values.newdigit2%> <%values.newdigit3%> <%values.newdigit4%>") / position = (50%, 70%) / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / size = (80%, 20%) / vjustify = center / items = ("<%expressions.buttoninstruct3%> ~nYou will be told the numbers at the beginning of each new round. ~nPay attention, the numbers are selected at random! ~nBe as quick as you can be to report your solution. You only have <%parameters.responseTimeout/1000%> seconds. Press START to start a practice session.") / position = (50%, 50%) / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / size = (80%, 80%) / vjustify = center / items = ("Practice is over. <%expressions.feedback%> ~nThe test is over once you have correctly reported 5 sequences for each number level 0-3 tested. ~nPress START to start the test.") / position = (50%, 50%) / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / size = (80%, 80%) / vjustify = center Note: the following expressions are inserted into the instructions depending on parameter settings /buttoninstruct1 = if (parameters.arithmeticProcedure == "subtract"){ "You will be asked to mentally SUBTRACT a given number from each of those digits " } else if (parameters.arithmeticProcedure == "multiply"){ "You will be asked to mentally MULTIPLY each of those digits by a given number " } else { "You will be asked to mentally ADD a given number to each of those digits " } /buttoninstruct2 = if (parameters.arithmeticProcedure == "subtract"){ "'SUBTRACT 2' from each of the following digits:" } else if (parameters.arithmeticProcedure == "multiply"){ "'MULTIPLY by 2' each of the following digits:" } else { "'ADD 2' to each of the following digits:" } /buttoninstruct3 = if (parameters.arithmeticProcedure == "subtract"){ "You will be asked to SUBTRACT numbers between 0 and 3 from each digit in the sequence." } else if (parameters.arithmeticProcedure == "multiply"){ "You will be asked to MULTIPLY each digit in the sequence by numbers between 0 and 3." } else { "You will be asked to ADD numbers between 0 and 3 to each digit in the sequence." } /feedback = if (parameters.testFeedback == false){ "The task will stay exactly the same as during practice but you will not receive feedback anymore." } else { "The task will stay exactly the same as during practice." } / items = ("The complete presented sequence was: <%values.digitSequence%>") / position = (50%, 50%) / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / size = (80%, 10%) / vjustify = center / items = ("repeat") / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / position = (50%, 80%) / size = (20%, 5%) / vjustify = center / txbgcolor = green / txcolor = white / items = ("START") / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / position = (50%, 90%) / size = (20%, 5%) / vjustify = center / txbgcolor = blue / txcolor = white / items = ("continue") / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / position = (50%, 90%) / size = (20%, 5%) / vjustify = center / txbgcolor = blue / txcolor = white / items = ("Get Ready!") / fontstyle = ("Arial", 8.00%, true, false, false, false, 5, 1) / size = (80%, 30%) / vjustify = center / caption = "Enter your solution" / position = (35%, 40%) / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / caption = "digit 1" / required = true / position = (30%, 50%) / mask = integer / maxchars = 2 / minchars = 1 / textboxsize = (8%, 4%) / monkeyresponse = (1, 2, 3, 4, 5, 6, 7, 8, 9, 0) / caption = "digit 2" / required = true / position = (40%, 50%) / mask = integer / maxchars = 2 / minchars = 1 / textboxsize = (8%, 4%) / monkeyresponse = (1, 2, 3, 4, 5, 6, 7, 8, 9, 0) / caption = "digit 3" / required = true / position = (50%, 50%) / mask = integer / maxchars = 2 / minchars = 1 / textboxsize = (8%, 4%) / monkeyresponse = (1, 2, 3, 4, 5, 6, 7, 8, 9, 0) / caption = "digit 4" / required = true / position = (60%, 50%) / mask = integer / maxchars = 2 / minchars = 1 / textboxsize = (8%, 4%) / monkeyresponse = (1, 2, 3, 4, 5, 6, 7, 8, 9, 0) /1 = "Correct" /2 = "The digit sequence was: <%values.digit1%> <%values.digit2%> <%values.digit3%> <%values.digit4%> ~n<%expressions.taskInstructions2%> ~n~nYou entered: <%textbox.digit1response.response%> <%textbox.digit2response.response%> <%textbox.digit3response.response%> <%textbox.digit4response.response%> ~nThe correct solution was: <%values.newdigit1%> <%values.newdigit2%> <%values.newdigit3%> <%values.newdigit4%>" Note: the following expressions are presented during error feedback depending on parameters.arithmeticProcedure /taskInstructions2 = if (parameters.arithmeticProcedure == "subtract"){ "Your task was to subtract <%values.level%> from each digit" } else if (parameters.arithmeticProcedure == "subtract"){ "Your task was to multiply each of the digits by <%values.level%>" } else { "Your task was to add <%values.level%> to each digit" } /1 = "ADD <%values.level%>" /3 = "SUBTRACT <%values.level%>" /3 = "MULTIPLY by <%values.level%>" / items = ("Thank you!") / fontstyle = ("Arial", 8%, true, false, false, false, 5, 1) / position = (50%, 50%) / size = (80%, 80%) / vjustify = center / items = ("EXIT") / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / position = (50%, 90%) / size = (20%, 5%) / vjustify = center / txbgcolor = blue / txcolor = white / items = ("Check Trial Timing Parameters") / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / position = (50%, 50%) / size = (80%, 80%) / vjustify = center ************************************************************************************************************** ************************************************************************************************************** EDITABLE LISTS: change editable lists here ************************************************************************************************************** ************************************************************************************************************** Note: the list can be edited to include levels 0-9 (NOTE: adjust instructions accordingly) / items = (0, 1, 2, 3) / replace = true / not = [ values.avoid0; values.avoid1; values.avoid2; values.avoid3; values.avoid4; values.avoid5; values.avoid6; values.avoid7; values.avoid8; values.avoid9 ] ************************************************************************************************************** !!!REMAINING CODE: Customize after careful consideration only!!! ************************************************************************************************************** ************************************************************************************************************** ************************************************************************************************************** DEFAULTS ************************************************************************************************************** ************************************************************************************************************** script requires Inquisit 6.1.0.0 or higher /canvasaspectratio = (4,3) /minimumversion = "6.1.0.0" / fontstyle = ("Arial", 3%, false, false, false, false, 5, 1) /txbgcolor = white / txcolor = black / screencolor = white ************************************************************************************************************** ************************************************************************************************************** DATA ************************************************************************************************************** ************************************************************************************************************** Note: data file explanations under User Manual Information at the top To change from one data file per participant to one data file for all participants, set /separatefiles = false *********************** raw data file *********************** / columns = (build, computer.platform, date, time, subject, group, script.sessionid, blockcode, blocknum, trialcode, trialnum, parameters.arithmeticProcedure, values.trialcount, values.level, values.digitSequence, values.corrSolution, values.currentResponse, textbox.digit1response.response, textbox.digit2response.response, textbox.digit3response.response, textbox.digit4response.response, values.ACC, values.countCorrDigits, values.RT, values.count0, values.countcorrect0, values.count1, values.countcorrect1, values.count2, values.countcorrect2, values.count3, values.countcorrect3, values.count4, values.countcorrect4, values.count5, values.countcorrect5, values.count6, values.countcorrect6, values.count7, values.countcorrect7, values.count8, values.countcorrect8, values.count9, values.countcorrect9) *********************** summary data file *********************** / columns = (computer.platform, script.startdate, script.starttime, script.subjectid, script.groupid, script.sessionid, script.elapsedtime, script.completed, parameters.arithmeticProcedure, values.levels, parameters.maxCorrectSolutions, values.passedTest, values.trialcount, values.count0, values.countcorrect0, values.count1, values.countcorrect1, values.count2, values.countcorrect2, values.count3, values.countcorrect3, values.count4, values.countcorrect4, values.count5, values.countcorrect5, values.count6, values.countcorrect6, values.count7, values.countcorrect7, values.count8, values.countcorrect8, values.count9, values.countcorrect9) ************************************************************************************************************** ************************************************************************************************************** VALUES: automatically updated ************************************************************************************************************** ************************************************************************************************************** /trialTimingWarning: 1 = positive warning: some of the trial timing parameters are in conflict with each other 0 = no conflicts of trial timing parameters detected /trialcount: counts the trials in the practice/test block (resets after practice) /sequenceCount: counts the number of unique sequences used during the practice and test session (with 4 digits from 0-9 (no repeats), there should be 5040 unique sequences) /level: the current level tested /digit1: contains the first digit presented /digit2: contains the second digit presented /digit3: contains the third digit presented /digit4: contains the fourth digit presented /newdigit1: contains the 'updated' first digit after adding/subtracting/multiplying the current level /newdigit2: contains the 'updated' second digit after adding/subtracting/multiplying the current level /newdigit3: contains the 'updated' third digit after adding/subtracting/multiplying the current level /newdigit4: contains the 'updated' fourth digit after adding/subtracting/multiplying the current level /digitSequence: contains all the digits in the order presented (e.g. "3456") /Sequences: stores all the presented digit sequences (resets after 5040 have been presented) /corrSolution: contains the correct solution for the current trial /response: contains the entered digits /ACC: 1 = the entered solution is correct; 0 = otherwise /RT: stores the latency (in ms); measured from onset of textboxes to pressing the submit-button helper variables to avoid selecting a level that has reach criteria: /avoid0 = -1 /avoid1 = -1 /avoid2 = -1 /avoid3 = -1 /avoid4 = -1 /avoid5 = -1 /avoid6 = -1 /avoid7 = -1 /avoid8 = -1 /avoid9 = -1 /nrPassedLevels: counts the number of levels that have reached criteria /stop: 1 = stop the block; 0 = do not stop the block /count0: counts the number of level 0 test trials /count1: counts the number of level 1 test trials /count2: counts the number of level 2 test trials /count3: counts the number of level 3 test trials /count4: counts the number of level 4 test trials /count5: counts the number of level 5 test trials /count6: counts the number of level 6 test trials /count7: counts the number of level 7 test trials /count8: counts the number of level 8 test trials /count9: counts the number of level 9 test trials /countcorrect0: counts the number of correct level 0 test trials /countcorrect1: counts the number of correct level 1 test trials /countcorrect2: counts the number of correct level 2 test trials /countcorrect3: counts the number of correct level 3 test trials /countcorrect4: counts the number of correct level 4 test trials /countcorrect5: counts the number of correct level 5 test trials /countcorrect6: counts the number of correct level 6 test trials /countcorrect7: counts the number of correct level 7 test trials /countcorrect8: counts the number of correct level 8 test trials /countcorrect9: counts the number of correct level 9 test trials /countCorrDigits: counts the number of correctly entered digits per trial /levels: stores all the levels run /passedTest: 0 = test terminated because max. allowed time was up; 1 = otherwise (reached criteria for all levels tested) /trialTimingWarning = 0 /trialcount = 0 /sequenceCount = 0 /level = 0 /digit1 = 0 /digit2 = 0 /digit3 = 0 /digit4 = 0 /newdigit1 = 0 /newdigit2 = 0 /newdigit3 = 0 /newdigit4 = 0 /digitSequence = "" /Sequences = "" /corrSolution = "" /currentResponse = "" /ACC = 0 /RT = 0 /avoid0 = -1 /avoid1 = -1 /avoid2 = -1 /avoid3 = -1 /avoid4 = -1 /avoid5 = -1 /avoid6 = -1 /avoid7 = -1 /avoid8 = -1 /avoid9 = -1 /nrPassedLevels = 0 /stop = 0 /count0 = 0 /count1 = 0 /count2 = 0 /count3 = 0 /count4 = 0 /count5 = 0 /count6 = 0 /count7 = 0 /count8 = 0 /count9 = 0 /countcorrect0 = 0 /countcorrect1 = 0 /countcorrect2 = 0 /countcorrect3 = 0 /countcorrect4 = 0 /countcorrect5 = 0 /countcorrect6 = 0 /countcorrect7 = 0 /countcorrect8 = 0 /countcorrect9 = 0 /countCorrDigits = 0 /levels = "" /passedTest = 1 /temp = 0 ************************************************************************************************************** ************************************************************************************************************** EXPRESSIONS ************************************************************************************************************** ************************************************************************************************************** /checkTrialTimingSettings = { if (parameters.delayTaskInstructions < parameters.readyDuration){ values.trialTimingWarning = 1; }; if (parameters.digit1Delay < (parameters.delayTaskInstructions + parameters.taskInstructionDuration)){ values.trialTimingWarning = 1; }; if (parameters.digit2Delay < (parameters.digit1Delay + parameters.digitDuration)){ values.trialTimingWarning = 1; }; if (parameters.digit3Delay < (parameters.digit2Delay + parameters.digitDuration)){ values.trialTimingWarning = 1; }; if (parameters.digit4Delay < (parameters.digit3Delay + parameters.digitDuration)){ values.trialTimingWarning = 1; }; if (parameters.recallDelay < (parameters.digit4Delay + parameters.digitDuration)){ values.trialTimingWarning = 1; }; } /checkLevels = { if (list.levels.itemcount >=1){ values.levels = concat(values.levels, list.levels.item(1)); }; if (list.levels.itemcount >=2){ values.levels=concat(values.levels, list.levels.item(2)); }; if (list.levels.itemcount >=3){ values.levels=concat(values.levels, list.levels.item(3)); }; if (list.levels.itemcount >=4){ values.levels=concat(values.levels, list.levels.item(4)); }; if (list.levels.itemcount >=5){ values.levels=concat(values.levels, list.levels.item(5)); }; if (list.levels.itemcount >=6){ values.levels=concat(values.levels, list.levels.item(6)); }; if (list.levels.itemcount >=7){ values.levels=concat(values.levels, list.levels.item(7)); }; if (list.levels.itemcount >=8){ values.levels=concat(values.levels, list.levels.item(8)); }; if (list.levels.itemcount >=9){ values.levels=concat(values.levels, list.levels.item(9)); }; if (!contains(values.levels, "0")){ values.count0 = "Not run"; values.countcorrect0 = ""; }; if (!contains(values.levels, "1")){ values.count1 = "Not run"; values.countcorrect1 = ""; }; if (!contains(values.levels, "2")){ values.count2 = "Not run"; values.countcorrect2 = ""; }; if (!contains(values.levels, "3")){ values.count3 = "Not run"; values.countcorrect3 = ""; }; if (!contains(values.levels, "4")){ values.count4 = "Not run"; values.countcorrect4 = ""; }; if (!contains(values.levels, "5")){ values.count5 = "Not run"; values.countcorrect5 = ""; }; if (!contains(values.levels, "6")){ values.count6 = "Not run"; values.countcorrect6 = ""; }; if (!contains(values.levels, "7")){ values.count7 = "Not run"; values.countcorrect7 = ""; }; if (!contains(values.levels, "8")){ values.count8 = "Not run"; values.countcorrect8 = ""; }; if (!contains(values.levels, "9")){ values.count9 = "Not run"; values.countcorrect9 = ""; }; } /selectTask = { if (parameters.arithmeticProcedure == "subtract"){ 2 } else if (parameters.arithmeticProcedure == "multiply"){ 3 } else { 1 }; } /generateDigitSequence = { values.temp = 0; while (values.temp == 0){ //reset necessary digit lists and variables list.digits.reset(); values.digitSequence = ""; values.corrSolution = ""; //select the first digit values.digit1 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit1);//store the first digit in the digit sequence if (parameters.arithmeticProcedure == "add"){ values.newdigit1 = values.digit1 + values.level; } else if (parameters.arithmeticProcedure == "subtract"){ values.newdigit1 = values.digit1 - values.level; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit1 = values.digit1 * values.level; } else {//for the default one (in case something else than the three above option was chosen) values.newdigit1 = values.digit1 + values.level; }; values.corrSolution = concat(values.corrSolution, values.newdigit1);//store the solution to the first digit in corr solution sequence //select the second digit values.digit2 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit2); if (parameters.arithmeticProcedure == "add"){ values.newdigit2 = values.digit2 + values.level; } else if (parameters.arithmeticProcedure == "subtract"){ values.newdigit2 = values.digit2 - values.level; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit2 = values.digit2 * values.level; } else { values.newdigit2 = values.digit2 + values.level; }; values.corrSolution = concat(values.corrSolution, values.newdigit2); //select the third digit values.digit3 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit3); if (parameters.arithmeticProcedure == "add"){ values.newdigit3 = values.digit3 + values.level; } else if (parameters.arithmeticProcedure == "subtract"){ values.newdigit3 = values.digit3 - values.level; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit3 = values.digit3 * values.level; } else { values.newdigit3 = values.digit3 + values.level; }; values.corrSolution = concat(values.corrSolution, values.newdigit3); //select the fourth digit values.digit4 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit4); if (parameters.arithmeticProcedure == "add"){ values.newdigit4 = values.digit4 + values.level; } else if (parameters.arithmeticProcedure == "subtract"){ values.newdigit4 = values.digit4 - values.level; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit4 = values.digit4 * values.level; } else { values.newdigit4 = values.digit4 + values.level; }; values.corrSolution = concat(values.corrSolution, values.newdigit4); //check that the digit sequence as not not been presented yet if (!contains(values.Sequences, values.digitSequence)){ values.Sequences = concat(values.Sequences, values.digitSequence); values.Sequences = concat(values.Sequences, ","); values.temp = 1;//if it's a new sequence then the while loop should end }; }; } /countCorrectDigits = { if (textbox.digit1response.response == values.newdigit1){ values.countCorrDigits += 1; }; if (textbox.digit2response.response == values.newdigit2){ values.countCorrDigits += 1; }; if (textbox.digit3response.response == values.newdigit3){ values.countCorrDigits += 1; }; if (textbox.digit4response.response == values.newdigit4){ values.countCorrDigits += 1; }; } ************************************************************************************************************** ************************************************************************************************************** INSTRUCTIONS ************************************************************************************************************** ************************************************************************************************************** / items = testFeedback / select = 1 / fontstyle = ("Arial", 8%, true, false, false, false, 5, 1) / txcolor = green / position = (50%, 50%) / vjustify = center / size = (80%, 10%) / items = testFeedback / select = 2 / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / txcolor = black / position = (50%, 50%) / vjustify = center / size = (80%, 80%) / shape = rectangle / color = white / width = text.digit1.width / height = text.digit1.height / position = (50%, 50%) / inputdevice = mouse / stimulusframes = [1 = intro1, welcome, continue] / validresponse = (continue) / recorddata = false / inputdevice = mouse / ontrialbegin = [ values.digitSequence = ""; list.digits.reset(); values.digit1 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit1); values.digitSequence = concat(values.digitSequence, " "); if (parameters.arithmeticProcedure == "subtract"){ values.newdigit1 = values.digit1 - 2; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit1 = values.digit1 * 2; } else { values.newdigit1 = values.digit1 + 2; }; values.digit2 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit2); values.digitSequence = concat(values.digitSequence, " "); if (parameters.arithmeticProcedure == "subtract"){ values.newdigit2 = values.digit2 - 2; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit2 = values.digit2 * 2; } else { values.newdigit2 = values.digit2 + 2; }; values.digit3 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit3); values.digitSequence = concat(values.digitSequence, " "); if (parameters.arithmeticProcedure == "subtract"){ values.newdigit3 = values.digit3 - 2; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit3 = values.digit3 * 2; } else { values.newdigit3 = values.digit3 + 2; }; values.digit4 = list.digits.nextvalue; values.digitSequence = concat(values.digitSequence, values.digit4); if (parameters.arithmeticProcedure == "subtract"){ values.newdigit4 = values.digit4 - 2; } else if (parameters.arithmeticProcedure == "multiply"){ values.newdigit4 = values.digit4 * 2; } else { values.newdigit4 = values.digit4 + 2; }; trial.intro2.insertstimulustime(text.digit1, 2000); trial.intro2.insertstimulustime(text.digit2, (2000 + parameters.digitDuration)); trial.intro2.insertstimulustime(text.digit3, (2000 + 2*parameters.digitDuration)); trial.intro2.insertstimulustime(text.digit4, (2000 + 3*parameters.digitDuration)); trial.intro2.insertstimulustime(shape.digitEraser, (2000 + 4*parameters.digitDuration)); trial.intro2.insertstimulustime(text.digitSequence, (3000 + 4*parameters.digitDuration)); trial.intro2.insertstimulustime(text.intro3, (3000 + 4*parameters.digitDuration)); trial.intro2.insertstimulustime(text.continue, (6000 + 4*parameters.digitDuration)); trial.intro2.insertstimulustime(text.repeatExample, (6000 + 4*parameters.digitDuration)); ] / stimulusframes = [1 = clearscreen, intro2, Example] / validresponse = (continue, repeatExample) / ontrialend = [ trial.intro2.resetstimulusframes(); ] / branch = [ if (trial.intro2.response == "repeatExample"){ return trial.intro2; }; ] / recorddata = false / inputdevice = mouse / stimulusframes = [1 = intro4, start] / validresponse = (start) / recorddata = false / inputdevice = mouse / stimulusframes = [1 = testIntro, start] / validresponse = (start) / recorddata = false / inputdevice = mouse / stimulusframes = [1 = finish, exit] / validresponse = (exit) / recorddata = false ************************************************************************************************************** ************************************************************************************************************** STIMULI ************************************************************************************************************** ************************************************************************************************************** / items = taskInstructions / select = expressions.selectTask / fontstyle = ("Arial", 8.00%, true, false, false, false, 5, 1) / size = (80%, 30%) / vjustify = center / items = ("<%values.digit1%>") / position = (50%, 50%) / fontstyle = ("Arial", parameters.digitSize, true, false, false, false, 5, 1) / size = (80%, parameters.digitSize*1.1) / vjustify = center / items = ("<%values.digit2%>") / position = (50%, 50%) / fontstyle = ("Arial", parameters.digitSize, true, false, false, false, 5, 1) / size = (80%, parameters.digitSize*1.1) / vjustify = center / items = ("<%values.digit3%>") / position = (50%, 50%) / fontstyle = ("Arial", parameters.digitSize, true, false, false, false, 5, 1) / size = (80%, parameters.digitSize*1.1) / vjustify = center / items = ("<%values.digit4%>") / position = (50%, 50%) / fontstyle = ("Arial", parameters.digitSize, true, false, false, false, 5, 1) / size = (80%, parameters.digitSize*1.1) / vjustify = center ************************************************************************************************************** ************************************************************************************************************** LISTS ************************************************************************************************************** ************************************************************************************************************** / items = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) / replace = false / selectionrate = always ************************************************* Data Lists: used for descriptive statistics store correct latencies/accuracy data fill up during runtime ************************************************* ************************************************************************************************************** ************************************************************************************************************** PRACTICE TRIALS ************************************************************************************************************** ************************************************************************************************************** / ontrialbegin = [ values.trialcount += 1; values.sequenceCount += 1; values.ACC = 0; values.countCorrDigits = 0; values.level = list.levels.nextvalue; expressions.generateDigitSequence; trial.mentalarithmetic_practice.insertstimulustime(clearscreen, parameters.readyDuration); trial.mentalarithmetic_practice.insertstimulustime(text.taskInstruction, parameters.delayTaskInstructions); trial.mentalarithmetic_practice.insertstimulustime(clearscreen, (parameters.delayTaskInstructions + parameters.taskInstructionDuration)); trial.mentalarithmetic_practice.insertstimulustime(text.digit1, parameters.digit1Delay); trial.mentalarithmetic_practice.insertstimulustime(clearscreen, (parameters.digit1Delay + parameters.digitDuration)); trial.mentalarithmetic_practice.insertstimulustime(text.digit2, parameters.digit2Delay); trial.mentalarithmetic_practice.insertstimulustime(clearscreen, (parameters.digit2Delay + parameters.digitDuration)); trial.mentalarithmetic_practice.insertstimulustime(text.digit3, parameters.digit3Delay); trial.mentalarithmetic_practice.insertstimulustime(clearscreen, (parameters.digit3Delay + parameters.digitDuration)); trial.mentalarithmetic_practice.insertstimulustime(text.digit4, parameters.digit4Delay); trial.mentalarithmetic_practice.insertstimulustime(clearscreen, (parameters.digit4Delay + parameters.digitDuration)); ] / stimulustimes = [0 = getReady] / timeout = parameters.digit4Delay + parameters.digitDuration / ontrialend = [ trial.mentalarithmetic_practice.resetstimulusframes(); ] / branch = [ return surveypage.mentalarithmetic_response_practice; ] / recorddata = false / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / itemfontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / questions = [1 = taskInstructions, digit1response, digit2response, digit3response, digit4response] / showpagenumbers = false / showquestionnumbers = false / responsefontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / finishlabel = "submit" / navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / navigationbuttonsize = (20%, 5%) / nextbuttonposition = (38%, 65%) / ontrialend = [ values.currentResponse = ""; values.currentResponse = concat(values.currentResponse, textbox.digit1response.response); values.currentResponse = concat(values.currentResponse, textbox.digit2response.response); values.currentResponse = concat(values.currentResponse, textbox.digit3response.response); values.currentResponse = concat(values.currentResponse, textbox.digit4response.response); if (values.currentResponse == values.corrSolution){ values.ACC = 1; }; if (monkey.monkeymode){ if (replace(0,1) == 1){ values.ACC = 1; }; }; expressions.countCorrectDigits; ] / branch = [ if (values.ACC == 1){ return trial.positiveFeedback_practice; } else { return trial.errorFeedback_practice; }; ] / recorddata = false / timeout = parameters.responseTimeout / stimulusframes = [1 = correctFeedback] / trialduration = parameters.feedbackDuration / recorddata = false / branch = [ return trial.ITI_practice; ] / inputdevice = mouse / stimulusframes = [1 = errorFeedback, continue] / validresponse = (continue) / recorddata = false / branch = [ return trial.ITI_practice; ] / ontrialbegin = [ values.RT = surveypage.mentalarithmetic_response_practice.latency; ] / trialduration = parameters.iti / recorddata = true / ontrialend = [ if (values.trialcount >= parameters.numberPracticeTrials){ values.stop = 1; }; ] / branch = [ return trial.mentalarithmetic_practice; ] ************************************************************************************************************** ************************************************************************************************************** TRIALS ************************************************************************************************************** ************************************************************************************************************** / ontrialbegin = [ values.trialcount += 1; values.sequenceCount += 1; values.ACC = 0; values.countCorrDigits = 0; values.level = list.levels.nextvalue; expressions.generateDigitSequence; trial.mentalarithmetic.insertstimulustime(clearscreen, parameters.readyDuration); trial.mentalarithmetic.insertstimulustime(text.taskInstruction, parameters.delayTaskInstructions); trial.mentalarithmetic.insertstimulustime(clearscreen, (parameters.delayTaskInstructions + parameters.taskInstructionDuration)); trial.mentalarithmetic.insertstimulustime(text.digit1, parameters.digit1Delay); trial.mentalarithmetic.insertstimulustime(clearscreen, (parameters.digit1Delay + parameters.digitDuration)); trial.mentalarithmetic.insertstimulustime(text.digit2, parameters.digit2Delay); trial.mentalarithmetic.insertstimulustime(clearscreen, (parameters.digit2Delay + parameters.digitDuration)); trial.mentalarithmetic.insertstimulustime(text.digit3, parameters.digit3Delay); trial.mentalarithmetic.insertstimulustime(clearscreen, (parameters.digit3Delay + parameters.digitDuration)); trial.mentalarithmetic.insertstimulustime(text.digit4, parameters.digit4Delay); trial.mentalarithmetic.insertstimulustime(clearscreen, (parameters.digit4Delay + parameters.digitDuration)); ] / stimulustimes = [0 = getReady] / timeout = parameters.digit4Delay + parameters.digitDuration / ontrialend = [ trial.mentalarithmetic.resetstimulusframes(); ] / branch = [ return surveypage.mentalarithmetic_response; ] / recorddata = false / fontstyle = ("Arial", 4%, true, false, false, false, 5, 1) / itemfontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / questions = [1 = taskInstructions, digit1response, digit2response, digit3response, digit4response] / showpagenumbers = false / showquestionnumbers = false / responsefontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / finishlabel = "submit" / navigationbuttonfontstyle = ("Arial", 3%, false, false, false, false, 5, 1) / navigationbuttonsize = (20%, 5%) / nextbuttonposition = (38%, 65%) / ontrialend = [ values.currentResponse = ""; values.currentResponse = concat(values.currentResponse, textbox.digit1response.response); values.currentResponse = concat(values.currentResponse, textbox.digit2response.response); values.currentResponse = concat(values.currentResponse, textbox.digit3response.response); values.currentResponse = concat(values.currentResponse, textbox.digit4response.response); if (values.currentResponse == values.corrSolution){ values.ACC = 1; }; if (monkey.monkeymode){ if (replace(0,1) == 1){ values.ACC = 1; }; }; expressions.countCorrectDigits; if (values.level == 0){ values.count0 += 1; if (values.ACC == 1){ values.countcorrect0 += 1; if (values.countcorrect0 == parameters.maxCorrectSolutions){ values.avoid0 = 0; values.nrPassedLevels += 1; }; }; } else if (values.level == 1){ values.count1 += 1; if (values.ACC == 1){ values.countcorrect1 += 1; if (values.countcorrect1 == parameters.maxCorrectSolutions){ values.avoid1 = 1; values.nrPassedLevels += 1; }; }; } else if (values.level == 2){ values.count2 += 1; if (values.ACC == 1){ values.countcorrect2 += 1; if (values.countcorrect2 == parameters.maxCorrectSolutions){ values.avoid2 = 2; values.nrPassedLevels += 1; }; }; } else if (values.level == 3){ values.count3 += 1; if (values.ACC == 1){ values.countcorrect3 += 1; if (values.countcorrect3 == parameters.maxCorrectSolutions){ values.avoid3 = 3; values.nrPassedLevels += 1; }; }; } else if (values.level == 4){ values.count4 += 1; if (values.ACC == 1){ values.countcorrect4 += 1; if (values.countcorrect4 == parameters.maxCorrectSolutions){ values.avoid4 = 4; values.nrPassedLevels += 1; }; }; } else if (values.level == 5){ values.count5 += 1; if (values.ACC == 1){ values.countcorrect5 += 1; if (values.countcorrect5 == parameters.maxCorrectSolutions){ values.avoid5 = 5; values.nrPassedLevels += 1; }; }; } else if (values.level == 6){ values.count6 += 1; if (values.ACC == 1){ values.countcorrect6 += 1; if (values.countcorrect6 == parameters.maxCorrectSolutions){ values.avoid6 = 6; values.nrPassedLevels += 1; }; }; } else if (values.level == 7){ values.count7 += 1; if (values.ACC == 1){ values.countcorrect7 += 1; if (values.countcorrect7 == parameters.maxCorrectSolutions){ values.avoid7 = 7; values.nrPassedLevels += 1; }; }; } else if (values.level == 8){ values.count8 += 1; if (values.ACC == 1){ values.countcorrect8 += 1; if (values.countcorrect8 == parameters.maxCorrectSolutions){ values.avoid8 = 8; values.nrPassedLevels += 1; }; }; } else if (values.level == 9){ values.count9 += 1; if (values.ACC == 1){ values.countcorrect9 += 1; if (values.countcorrect9 == parameters.maxCorrectSolutions){ values.avoid9 = 9; values.nrPassedLevels += 1; }; }; }; ] / branch = [ if (parameters.testFeedback == true){ if (values.ACC == 1){ return trial.positiveFeedback; } else { return trial.errorFeedback; }; } else { return trial.ITI; }; ] / recorddata = false / timeout = parameters.responseTimeout / stimulusframes = [1 = correctFeedback] / trialduration = parameters.feedbackDuration / recorddata = false / branch = [ return trial.ITI; ] / inputdevice = mouse / stimulusframes = [1 = errorFeedback, continue] / validresponse = (continue) / recorddata = false / branch = [ return trial.ITI; ] / ontrialbegin = [ values.RT = surveypage.mentalarithmetic_response.latency; ] / trialduration = parameters.iti / recorddata = true / ontrialend = [ if (values.nrPassedLevels == list.levels.itemcount){ values.stop = 1; }; if (values.sequenceCount == 1000){ values.Sequences = ""; }; ] / branch = [ return trial.mentalarithmetic; ] / inputdevice = mouse / skip = [ values.trialTimingWarning == 0 ] / stimulusframes = [1 = warning, exit] / validresponse = (exit) / ontrialend = [ script.abort(); ] ************************************************************************************************************** ************************************************************************************************************** BLOCKS ************************************************************************************************************** ************************************************************************************************************** Note: this block checks that the parameters that control trial timings are not conflicting / onblockbegin = [ expressions.checkTrialTimingSettings; ] / trials = [1 = trialTimingWarning] / trials = [1 = intro1; 2 = intro2; 3 = intro3] / stop = [ values.stop == 1; ] / onblockbegin = [ values.trialcount = 0; values.stop = 0; ] / trials = [1 = mentalarithmetic_practice] / stop = [ values.stop == 1; ] / onblockbegin = [ values.trialcount = 0; values.stop = 0; ] / trials = [1 = testIntro; 2 = mentalarithmetic] / timeout = parameters.maxTestTime / onblockend = [ if (values.nrPassedLevels < list.levels.itemcount){ values.passedTest = 0; }; ] / trials = [1 = finish] ************************************************************************************************************** ************************************************************************************************************** EXPERIMENT ************************************************************************************************************** ************************************************************************************************************** / onexptbegin = [ expressions.checkLevels; ] / blocks = [ 1 = trialTimingCheck; 2 = intro; 3 = practice; 4 = test; 5 = finish; ] ************************************************************************************************************** End of File **************************************************************************************************************