Item numbers and Item Number Parsing for DMDX output files

 

Rationale for Meaningful Item Numbers

 

The primary reason for coding your within subject information into your item numbers in your DMDX script is that it is much easier to do this work on the front end (once in the item file) rather than having to reconstruct this information by hand or other method for every subject at the end.  In particular, this will be critical if you use scrambling, but in all instances, it will save you time

 

Instructions for Creating Meaningful Items Numbers in DMDX Script

 

Your coding scheme should be clear and systematic so that you can easily identify each of your trials and sort them for analysis.

 

Here are some steps and rules for designing a code for your variables:

 

1. You can use as many digits as you need to include information for all of your variables. If you are running a psychophysioloigcal experiment, you might want your item numbers match you event markers (the codes that are sent to the amplifier to mark trial onset and identity). However, if you are using Neuroscan or EGI amplifiers (and probably others), your codes are limited to 3-digits, with a maximum value of 255 (i.e., 8-bit).   Therefore, in some instances you may code more information into your DMDX item numbers for subsequent behavioral analysis than you can code into your event markers.

 

2. Each place (10s,100s,1000s place, etc) should designate a separate within subjects variable.

 

3. Each TYPE of item should have the same item code, so that you can sort and average all of the items that fall into a particular category of interest.

 

4. Whatever coding scheme you develop, be sure to keep a reference handy! A good idea would be to include it in comments at the top of your DMDX script as well.

 

An example of a DMDX script with meaningful item numbers is provided.  If you care to run the script you will need the happy, fearful and neutral face bmps.  The example is for a 1-back working memory task involving emotional faces.  Four factors about each trial are coded in the four digit item numbers (item format ABCD)

A= trial type (1=match, 2=non-match)

B = emotion (1 = neutral, 2= happy, 3= fear)

C = condition (1 = face, 2 = word)

D = experiment block (1-4)

 

Instructions for Parsing Items in DMDX Output

Once you have designed your coding scheme, you can then use simple mathematical operations (mod and trunc) in Excel or SPSS to parse an item number in the output file into separate within subject variables.


Trunc returns the integer portion of a real number.  For example:  Trunc (1.2) = 1;  Trunc (2.7) = 2

 

We can also put expressions inside the ( ).  For example:   Trunc(112 / 10) = 11;    Trunc(191 / 100) = 1

 

Mod returns the integer remainder of a division operation:  For example:  Mod(5,2) = 1;  Mod (11,4) = 3

 

 

The basic strategy to extract a target position in a numeric string (e.g., 23543) involves 2 steps:

 

1. Isolate your target position by moving it to the ones column. Divide your string of numbers by a factor of 10 (10, 100, 1000, etc), chosen so that the "1" in the factor of 10 is in the same position as the position of your target number. Take the "TRUNC" of this number.

 

For example, if you have the number 23543, and you want to isolate the "4," you would divide by 10, because the 4 is in the 10's place.

E.g., Trunc (23543/10) = 2354

 

2. Once your target number is in the ones place, you just need to divide your number by 10, and take the "MOD" (or remainder) of this division.  This will isolate the number "4."

E.g., Mod (2354/10) = 4

 

If, however, you wish to isolate a 2-digit code (say 54, instead of 4), then you would divide your number by 100 instead of 10.

E.g., Mod (2354/100) = 54

So the rule is that if you want a 1-digit number, divide by 10; if you want a 2-digit number, divide by 100; if you want a 3-digit number, divide by 1000, etc.

 

You can also combine these two steps into one formula

Mod(Trunc(23543/10),10) = 4

 

However, if you want to extract the first number in your item code (or the first two numbers), you only need to use the "TRUNC" function:

E.g. Trunc (23543/1000) = 23, or Trunc (23543/10000) = 2

 

A Quiz (or more examples)

What is the formula to extract the 7 from 2455471

Mod(trunc(2455471 / 10),10)

 

What about the 2?

Mod(trunc(2455471 / 1000000),10)

 

What about the 1?

Mod(trunc(2455471 / 1),10)  or Mod(2455471,10)

 

What about the 55?

Mod(trunc(2455471 / 1000),100)

 

Templates

An example of a DMDX AZK output file from one participant run through the above emotional face 1-back task is available.  In addition, we provide an example of an excel spreadsheet with these data and columns containing formulas to extract each within subject variable.

 

Finally, here are the same examples if you process your data in SPSS (Original Data in SPSS; SPSS syntax file for parsing items)

 

Created by Jessica Shackman

Last updated 11-09-2005