___________________________________________________________________________________________________________________ n-back task for the touchscreen ___________________________________________________________________________________________________________________ Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC Date: 04-26-2022 last updated: 01-02-2025 by K. Borchert (katjab@millisecond.com) for Millisecond Software, LLC Script Copyright © 01-02-2025 Millisecond Software ___________________________________________________________________________________________________________________ BACKGROUND INFO ___________________________________________________________________________________________________________________ This script implements a touchscreen version of a simple nBack task, a measure of visual working memory. The implemented task uses a suit of ordinary playing cards as stimuli. Researchers can set the level of of n-back task to run as well as the number of trials and ratio of targets to non-targets. The implemented script only runs the selected nBack level but could be customized to run more levels if needed. Note the script runs with proportional sizing by default. Researchers can select to run the task with an absolute screen size to ensure that distances stay the same across devices. See section Defaults for more info. //References// //1-back procedure with 42 trials and using cards as stimuli:// Maruff P, Thomas E, Cysique L, Brew B, Collie A, Snyder P, Pietrzak RH. Validity of the CogState brief battery: relationship to standardized tests and sensitivity to cognitive impairment in mild traumatic brain injury, schizophrenia, and AIDS dementia complex. Arch Clin Neuropsychol. 2009 Mar;24(2):165-78. doi: 10.1093/arclin/acp010. Epub 2009 Mar 25. PMID: 19395350. //general reference for n-back procedure: Jaeggi, Susanne M.; Studer-Luethi, Barbara; Buschkuehl, Martin; Su, Yi-Fen; Jonides, John; Perrig, Walter J. (2010). The relationship between n-back performance and matrix reasoning - implications for training and transfer. Intelligence, 38, 625–635. ___________________________________________________________________________________________________________________ TASK DESCRIPTION ___________________________________________________________________________________________________________________ Participants get presented with a deck of cards (consisting of the regular 4 suits - 13 cards per suit) and the cards will be turned over one by one. Depending on the level of N tested (editable parameter), participants are asked to decide for each card whether the current card: N=0: is the pre-defined target card (by default, it's the 10 of diamonds in this script) N=1: is the same as the card before it (= target) N=2: is the same as the card 2-cards before it (= target) etc. If they think the current card is a target, they should press the 'Yes' response button. If they think the card is not a target, they should press the 'No' response button. Participants are instructed to respond as quickly and accurately as they can. Once a response button is pressed, the button is highlighted in yellow. After the card has been presented for 2seconds an animation is started that 'returns' the card back to the stack. The next trial is initiated once participants press a 'Home Button'. The 'Home Button' is implemented to ensure that response fingers are roughly equally distanced from both the no and yes button for each trial. __________________________________________________________________________________________________________________ DURATION ___________________________________________________________________________________________________________________ the default set-up of the script takes appr. 4 minutes to complete ___________________________________________________________________________________________________________________ DATA OUTPUT DICTIONARY ___________________________________________________________________________________________________________________ The fields in the data files are: (1) Raw data file: 'singlenBacktaskShapesRaw.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. //Play Setup: canvasHeightMM: the width of the play area in mm canvasWidthMM: the height of the play area in mm distanceHomeButtonResponseButtonMM: the calculated distance (in mm) between center of homeButton and center of one of the response buttons n: the current level N tested blockCounter: the total number of experimental blocks run trialCounter: counts the target and nontarget trials per block (Note: start trials are excluded from count) startTrialCounter: keeps track of how many start trials have been run stimulusItem.1: the shape presented stimulusNumber.1: the item number of the presented shape currentTarget: the item number of the current target //custom DVs for main nBack trials// rsp: the Response of the participant yes/no/NR = no response acc: the correctness of the response (1 = correct; 0 = otherwise) rt: how fast a participant responded within the given timeframe, if at all (in ms) no responses => empty list.blockAcc.mean: proportion correct during the current block (start trials are excluded from block acc assessment by design) //built-in DVs (will not record any useable data for the main nBack trials) response: the Response of the participant correct: the correctness of the response (1 = correct; 0 = otherwise) latency: how fast a participant responded within the given timeframe, if at all (in ms) no responses = the entire trialduration (2) Summary data file: 'singlenBacktaskShapesSummary*.iqdat' (a separate file for each participant) inquisit.version: Inquisit version run computer.platform: the platform the script was run on (win/mac/ios/android) startDate: date script was run startTime: time script was started subjectId: assigned subject id number groupId: assigned group id number sessionId: assigned session id number elapsedTime: time it took to run script (in ms); measured from onset to offset of script completed: 0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run) //Play Setup: canvasHeightMM: the width of the play area in mm canvasWidthMM: the height of the play area in mm distanceHomeButtonResponseButtonMM: the calculated distance (in mm) between center of homeButton and center of one of the response buttons //Parameter Settings: levelN: level of N tested blocksPerTest: number of test blocks run trialsPerBlock: number of trials per block to run numberTargetTrialsPerBlock: number of target trials per block numberNontargetTrialsPerBlock: number of nontarget trials per block ratioTtoNT: ratio 'Target:nontarget' The following summary variables are only based on performance on trial.target/trial.nontarget (excludes trial.start) propCorrectOverall: overall proportion correct (across all test blocks), across target and nontarget trials countNROverall: the number of no responses (timeouts) across target and nontarget trials meanCorrRTOverall: overall mean correct response time (in ms), across target and nontarget trials ////////////The following summary variables are only used if more than one test block are run://////// //per block: propCorrectBlock1: block1 proportion correct, across target and nontarget trials countNRBlock1: the number of no responses (timeouts) across target and nontarget trials during block1 meanCorrRTBlock1: block1 mean correct response time (in ms), across target and nontarget trials //block2 and higher //Note: as block1 could be used as practice, 'block2' uses all data collected after block1 propCorrectBlock2: block2 proportion correct, across target and nontarget trials countNRBlock2: the number of no responses (timeouts) across target and nontarget trials during block2 meanCorrRTBlock2: block2 mean correct response time (in ms), across target and nontarget trials ___________________________________________________________________________________________________________________ EXPERIMENTAL SET-UP ___________________________________________________________________________________________________________________ Test: by default this script runs 1 testblock (Editable Parameter) with 42+ trials each (Editable Parameter) using the 13 clubs cards (editable*). The script provides a brief resttrial (self-paced) after each block. => + trials are the N trials that cannot display target shapes yet (=start trials). Their numbers vary depending on N. The data collected during these start trials are NOT included in performance counts => Of the actual 42 experimental trials, half of the trials present a target (Editable Parameter) - The computer selects randomly a) whether it is a target trial or not and b) what card to show if it is not a target trial (cards are selected randomly with replacement with the constraint that it cannot be the current target stim) Trial Information: -> each trial starts with a HomeButton press (reminder presented after 2s) -> cards get uncovered for 2s, wait for response; if response is made, the response button is highlighted to give response feedback, card animation is started after 2s regardless of response -> card animation for 1000ms If the homebutton is pressed at the end of the animation trial, the next card is uncovered immediately. ___________________________________________________________________________________________________________________ STIMULI ___________________________________________________________________________________________________________________ 52 cards, see section Editable Stimuli By default, only the 13 club cards are currently used for the task. However, you can easily edit the list of cards. Note: A longer list likely makes the nBack less challenging as random repeats of nontarget cards (in nontarget positions) are less likely to happen with a larger selection pool. Thus, any repeated cards is much more likely to be a target. ___________________________________________________________________________________________________________________ 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: //Design Parameters / levelN = 1 //level of N tested (default: N = 1) //Instruction examples provided only for 0<=N<=3 (but the code allows for higher N as well) / blocksPerTest = 1 //number of blocks per test / trialsPerBlock = 42 //number of n-back trials per block (excluding starttrials) / proportionTargets = 0.5 //proportion of target n-back trials //Note: parameters.proportionTargets * parameters.trialsPerBlock => should result into an integer //The script will calculate the number of target trials and round to the nearest integer / stimulusPresentationTimeMs = 2000 //the time (in ms) that the uncovered card is presented before the return animation starts //Note: the animation adds another 1s to the procedure / itemNumberTargetN0 = 2 //the itemNumber of item.cards that is currently used as the target for N=0 trials //Note: if this number if changed or if the card under itemNumber = 2 (Note: 0-based selection) is changed, //instructions need to change accordingly. / debugmode = 0 //debugmode = 1: targetAlerts are shown on screen, //debugmode = 0, no targetAlerts are shown (default) //color parameter / canvasColor = black //Display color of the actively used portion of the screen (the 'canvas') //Note: if set to a color other than the screenColor, you can distinguish the active canvas //from the inactive portion of the screen / screenColor = black //Color of the screen not used by the canvas ('inactive screen') / defaultTextColor = white //Default color of text items //CANVAS SIZING PARAMETERS //sizing Parameters in RELATIVE measurements relative to CANVAS HEIGHT //NOTE: to run the script with ABSOLUTE screen measurements, go to 'defaults' and set //canvasSize to absolute measurements //Sizing Parameters / cardSizePct = 40% //the height of the cards in canvas height percentage (default: 40%)