Creating Text and Picture Stimuli

The first step in creating our script is to define the various stimuli that will be presented in the IAT. In this case, the stimuli will be a mix of text (good and bad words) and pictures (flowers and insects). Other stimuli include task instructions, a big red "X" for an error message, and category labels to remind participants which response keys map to which categories.

The good and bad text stimuli are defined as follows:

<text attributeA>
/ items = attributeA
/ txcolor = (0, 255, 0)
</text>

<text attributeB>
/ items = attributeB
/ txcolor = (0, 255, 0)
</text>

The txcolor attribute sets the red, green, and blue components of the text color. Green is set to the maximum value, wherease red and blue are 0, so both sets of words will appear green. The actual words in the set are specified separately in item elements called "attributeA" and "attributeB", which are defined below. We'll use generic names like "attribruteA" throughout the script to illustrate that the script contains mostly generic IAT logic that can be easily adapted to different target categories and attributes.

Next, we'll define the pictures representing the target categories, flowers and insects:

<picture targetB>
/ items = targetB
/ size = (20%, 20%)
</picture>

<picture targetA>
/ items = targetA
/ size = (20%, 20%)
</picture>

Like the text elements, the items are defined in separate item elements. The size of the pictures is set to 20% of the height and width of the screen. In fact, all sizes for pictures and text in this script will be defined in terms of percentage of the screen. This allows the IAT to scale proportionally to different monitor sizes, making it suitable for the web where users run a wide range of display systems.

Now we'll define the category labels that appear in the upper left and right corners of the screen. The attribute labels are as follows:

<text attributeAleft>
/ items = attributeAlabel
/ valign = top
/ halign = left
/ position = (5%, 5%)
/ txcolor = (0, 255, 0)
</text>

<text attributeBright>
/ items = attributeBlabel
/ valign = top
/ halign = right
/ position = (95%, 5%)
/ txcolor = (0, 255, 0)
</text>

The first label is presented in the upper left corner at a 5% margin from the upper and left edges of the screen as defined by the position attribute. The second label is presented in the upper right corner of the screen, again with 5% margins. The color of both labels is green, just like the stimuli themselves. The items attribute specifies that the actual label text is defined in an item elements below.

Now for the target labels. These are similar to the attribute labels, except that they are presented in the default text color (we'll set the default to white later in the tutorial).

<text targetAleft>
/ items = targetAlabel
/ valign = top
/ halign = left
/ position = (5%, 5%)
</text>

<text targetBright>
/ items = targetBlabel
/ valign = top
/ halign = right
/ position = (95%, 5%)
</text>

Recall that in the IAT, the target categories switch sides midway through the test, so we'll also define labels that place category A on the right and B on the left:

<text targetBleft>
/ items = targetBlabel
/ valign = top
/ halign = left	
/ position = (5%, 5%)
</text>

<text targetAright>
/ items = targetAlabel
/ valign = top
/ halign = right
/ position = (95%, 5%)
</text>

Next we'll create category labels for the critical trials where the targets and attributes are mixed together, for example, "Flowers or Good" and "Insects or Bad". On these trials, we'll present the target labels we created above. Just below those labels we'll present the word "or", and just below those the attribute labels will be presented:

<text orleft>
/ items = ("or")
/ valign = top
/ halign = left
/ position = (5%, 12%)
</text>

<text attributeAleftmixed>
/ items = attributeAlabel
/ valign = top
/ halign = left
/ position = (5%, 19%)
/ txcolor = (0, 255, 0)
</text>

These labels are similar to those above, except that the position attribute specifies that the "or" label be presented 12% of the way from the top of the screen just below the target label. The attribute label appears 19% of the way down the screen below the "or". Now we'll create the corresponding labels for the right side of the screen:

<text orright>
/ items = ("or")
/ valign = top
/ halign = right
/ position = (95%, 12%)
</text>

<text attributeBrightmixed>
/ items = attributeBlabel
/ valign = top
/ halign = right
/ position = (95%, 19%)
/ txcolor = (0, 255, 0)
</text>

That does it for the labels. Now we'll define instruction text:

<text instructions>
/ items = instructions
/ hjustify = left
/ size = (90%, 60%)
/ position = (50%, 85%)
/ valign = bottom
/ select = instructions
/ fontstyle = ("Arial", 3.5%)
</text>

The instructions text element differs from the others above in that it uses the size attribute to define a rectangle within which the presented text is word-wrapped. This is useful for displaying sentences and paragraphs. The hjustify command specifies that text should be left justified within this rectangle. Whereas the previous text elements use the default font, the instructions element specifies the "Arial" font at 3.5% of the screen height.

The final difference to note is the select attribute. There are a total of 7 instruction items (defined below). Each time this text element is presented, a different item is selected for presentation. The select attribute specifies that the rules for selecting the next item are contained in a counter element named instructions, which is defined as follows:

<counter instructions>
/ resetinterval = 20
/ select = sequence(1, 2, 3, 4, 5, 6, 7)
</counter>

The counter element allows you to create a customized selection algorithm. In this case, the counter's select attribute specifies that items should be selected in sequence (1, 2, 3, 4, 5, 6, 7). What does the resetinterval mean? By default, counters only remember selection for the duration of a single block. Once that block is over, the counter is reset, its memory erased, so that next time it is used for selection, it will start the sequence from the begining. The resetinterval attribute specifies how many blocks the counter memory lasts. We want the counter to track the state of the sequence for the duration of the experiment, so we've set it here to an arbitrary high number of 20. Any number greater than the number of blocks in the IAT would do the trick here.

Next we'll create a simple text that tells participants to hit the space bar to advance past the instructions. This appears in the lower middle of the screen beneath the instructions text.

<text spacebar>
/ items = ("Press the SPACE BAR to begin.")
/ position = (50%, 95%)
/ valign = bottom
/ fontstyle = ("Arial", 3.5%)
</text>

Just one last text element to create and we'll move on to the actual item sets used by some of the stimuli above.

<text error>
/ position = (50%, 75%)
/ items = ("X")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 10%, true)
</text>

The element above creates an error stimulus, which is a big red "X", presented in a bold Arial font that is 10% of the height of the screen. Hard for our participants to miss that.

If you're goal is simply to adapt the IAT to a specific set of target and attribute categories, the last section below is by far the most interesting. This section defines the labels and members of each category. The logic contained in the rest of the script is generic to any category. Thus, in order to change the categories, we can make all of our modifications here and leave the rest of the IAT procedure as is.

First we'll define the label and members of the "Good" category:

<item attributeAlabel>
/1 = "Good"
</item>

<item attributeA>
/1 = "Marvelous"
/2 = "Superb"
/3 = "Pleasure"
/4 = "Beautiful"
/5 = "Joyful"
/6 = "Glorious"
/7 = "Lovely"
/8 = "Wonderful"
</item>

Next we'll define the label and members of the "Bad" category:

<item attributeBlabel>
/1 = "Bad"
</item>

<item attributeB>
/1 = "Tragic"
/2 = "Horrible"
/3 = "Agony"
/4 = "Painful"
/5 = "Terrible"
/6 = "Awful"
/7 = "Humiliate"
/8 = "Nasty"
</item>

Our IAT will test participants' preferences for flowers or insects, so the following specify the labels and pictures files for these categories:

<item targetAlabel>
/1 = "Flowers"
</item>

<item targetA>
/1 = "flower1.jpg"
/2 = "flower2.jpg"
/3 = "flower3.jpg"
/4 = "flower4.jpg"
/5 = "flower5.jpg"
/6 = "flower6.jpg"
/7 = "flower7.jpg"
/8 = "flower8.jpg"
</item>

<item targetBlabel>
/1 = "Insects"
</item>

<item targetB>
/1 = "insect1.jpg"
/2 = "insect2.jpg"
/3 = "insect3.jpg"
/4 = "insect4.jpg"
/5 = "insect5.jpg"
/6 = "insect6.jpg"
/7 = "insect7.jpg"
/8 = "insect8.jpg"
</item>

That's does it for stimuli. This section has demonstrated a number of concepts, including presenting pictures and text, controlling stimulus size and position on the screen, specifying size, color, and face of a font, using a custom algorithm for stimulus item selection, and more.


Overview Creating Instructions