Today we are going to focus on 4 different levels of the experiment and how to specify them in an Inquisit script: stimulus, trial, block, and experiment level.
All the information that Inquisit needs to run your experiment needs
to be passed to it by defining special objects called
elements. Inquisit has hundreds of different elements
that it uses, each of which has a specific role. Today we are going to
use six different elements; items
, text
,
trial
, block
, expt
and
defaults
.
Each element in Inquisit has a list of properties or
attributes that you can set, which define how this
specific version of that element will behave. Different elements have
different attributes that apply to them, depending upon the role of that
particular element. For instance text
element defines how
text is presented on the screen. Therefore most of its attributes define
aspects of the appearance of the text such as the font
(fontstyle
), justification (hjustify
), text
size (size
), location on the screen (position
)
etc. In a single script you may use the same type of element multiple
times (e.g. multiple text
elements) with different settings
for its attributes each time to produce different effects at different
points in the Experiment.
The best way to learn about an element and its attributes is to look
at the Help
page for the element. The easiest way to get
the help file is to type the name of the element into the search bar
under the Help
menu at the top of the screen. Try this for
the text
element. The help file should contain a list of
attributes that can be passed to text
, each with a link to
the help file for that attribute, as well as other useful information,
like examples of usage, and an explanation of what the element does
(under Remarks). You can also search directly for a
attribute help file. The Help file for an attribute contains similar
information. One useful piece is the list of elements that the attribute
can be applies to, given under Applies to.
Creating an element is very straightforward. The first step is to type the tags for the element in your script and a label that allows you to refer to that element elsewhere in the script. Here is an example for a text element:
<text firsttext>
</text>
For all elements the format of these tags is the same. For the
open-tag (i.e. the first line of the script), you first
type an <
then the name of the type of element you want
to create (in this case text
). Then you give a name to this
element that you will use later if you refer to it in the code for
another element. here I have chosen the name firsttext. You
then close the tag >
.
An open-tag lets Inquisit know that you are now
going to define attributes for this specific element. The
close-tage (second line of script, which starts with
</
rather than <
), tells inquisit that
you are finished with this element. Therefore any attributes that you
want to define for this element need to be typed between the two tags.
For instance we could set the justification of this text to
left as follows:
<text firsttext>
/hjustify=left
</text firsttext>
Each attribute you want to set should be on a separate line starting
with /
followed by the attribute name (in this case
hjustify
).
All elements have attributes which define how this element links to
the other elements in your script. Inquisit is set up in a very
heirarchical structure, so an element will refer to
other elements that are lower than it in the hierarchy
(e.g. block
elements refer to trial
elements),
and will themselves be referred to by elements higher in the heirarchy.
The attributes in the higher element are then used to define how the
lower element is used. For example, one of the elements that can be
referred to in a text
element is an item
element, which is a list of items that the attributes of the text
element should be applied to. For instance, if we had created an
item
called stimlist we could tell Inquisit that
firsttext should use this particular item
list
with the following code:
<text firsttext>
/items=stimlist
/hjustify=left
</text>
After opening Inquisit the first step we will take is to create a new
script file. You can do this either from the menu
file>new
or by clicking on the blank page. Before we go
further save the script in the following format
wpa_3_FirstLast.iqx
. This is the file you will email to me
at the conclusion of class.
Now that you have a script file, copy the following code into the top of your file:
<defaults>
/quitcommand = (Ctrl+'e')
/fontstyle=("Arial", 3%)
</defaults>
We will put this at the top of all scripts from now on. In it we have
created an element of type defaults
This is a bit different
from the other elements we will define, as it doesn’t get a name because
you won’t be creating multiple elements of this type. As its name
suggests this element allows us to define some default behaviour in our
script that will be employed unless an element directly contradicts
it.
The two attributes we have defined for defaults
are
fontsyle
which sets the default font to be used as
Arial
unless a specific element says otherwise and
quitcommand
. The quitcommand
attribute sets a
key combination that can be used to exit the Experiment at any time. I
strongly recommend you always include a quitcommand
and
always check if there is a quitcommand
before using anyone
elses code. The default is Ctrl+Q, so you will get an error message if
you try to use that.
Use the Help
function to learn more about these.
This week our stimuli are just going to be a list of sentences: “(a)
50% chance of winning CHF 600 or (b) a sure gain of CHF XXX”, where XXX
varies from 1 to 600 in steps of 30. If you look at the
Help
file for the item element you will see that one way
you can use this element is to create a list of text element stimuli.
Each attribute in the list is just the specification of a number
stimuli. For example the following code created an item list (called
stimlist) that is just a single item, displaying text called
item 1:
<item stimlist>
/1="item 1"
</item>
NOTE: Items don’t have to be text strings. For example you could also specify images that we want to be used as the individual stimuli (this is what we did last week).
Exercise 1a: Alter this code, so that instead the first item of the list is the first choice that you want to be displayed to participants. Then alter the code further so that the list contains 21 items, rather than a single item.
Now that we have defined our stimuli, we need to specify how they
should look when displayed on the screen. Because our stimuli are text,
we can do this by defining a text
element where we call
this stimuli list. We can call this element anything we wish. I suggest
using the name stimlist_text for the text
element,
to make it easy for you to tell that these two elements are related. You
can have multiple different elements with the same name, as long as the
elements are not of the same type (i.e., you can’t have 2
item
elements called stimlist). However, I do suggest to
change the name slightly to avoid confusion.
Exercise 1b: Create the text
element,
and have it refer to your stimuli list.
Exercise 1c: Lets set our attributes so that our
stimuli will be displayed in the center of the screen, with center
justification, and in Arial font. To get our stimuli in the center of
the screen you’ll need to use the position
attribute. This
attribute takes 2 coordinates that can be defined in different ways. I
recommend defining the coordinates in terms of percentages of the screen
where (0%, 0%) would be the top left of the screen and
(100%, 100%) would be the top right.
Exercise 1d: The final step we need to take is to
define in what order our stimuli will be displayed. This is also done at
the level of text
element. If you look at the help file you
will see an attribute called text
. This determines how
text stimlist
selects a stimuli from
item stimlist
to display each time it is called. For now
set this attribute to sequential (i.e. /select=sequence
).
This means it should display all 21 items in order (we will check this
later).
So far you have defined what your stimuli are, and what they look
like. Now we need to tell Inquisit what it should do with these stimuli
on a trial. This means that we need to create a trial
element. Lets call this trial element choice
to remind us
that this is what we are asking participants to do on the trial. Create
the element:
<trial choice>
</trial>
For this week all we really want to happen on the trial is for the stimulus to be displayed at some point, and to stay up there until the participant responds. So first we will tell Inquisit how it should display stimuli.
To display the stimuli we need to set the stimulustimes
attribute of our trial
element. Stimulustimes
determines both when dring the trial stimuli should be displayed, and
what stimuli should be displayed at each time.
Exercise 2a: Specify that the text stimulus is shown right at the start of the trial.
Now we need to tell Inquisit how to collect responses on the trial. In this case we will pretend that we have asked participants to respond by using the keyboard. In particular we have told them to press the A key if they wish to choose the risky option, and the B key if they wish to choose the sure option.
Given this, we need to tell Inquisit that it should be waiting for
one of these two keys to be pressed. We can do this by setting the
validresponse
attribute.
Exercise 2b: Specify A and B as valid responses.
The next step is to define what a block of our Experiment looks like,
by creating a block
element. We only have a single block of
trials in our study. If you look at the Help
file you will
see that there are many behaviours we can define at the block level. As
this Experiment is very simple, and we aren’t including instructions
yet, we will only need to define the trials
element.
The trials
attribute is somewhat (not really) similar to
the stimulustimes
attrbute and somewhat similar to the
select
attribute of the text
element. The
trials
attribute lets us define how many trials there
should be in the block, and what type of trial should be displayed on
each of those trials. For now, we want to display the same trial type on
every trial (trial choice
) and we want to display all 21
version of this trial.
Exercise 3: Define a block
element made
of the above defined 21 trials, giving it the name
choiceblock
.
The exp
can be used for displaying instruction pages and
for setting the order in which participants should view different parts
of the Experiment. While the block
element defines the
order of trials
in a block
, the
expt
element defines the order of blocks
.
Here, we only have one block and want it to be displayed once.
Exercise 4: Create an expt
element made
of the above defined choice block.
Congratulations, you should now have a working Experiment. Try it out before you attempt the rest of the Exercises.
By default, Inquisit generates a datafile when you run the Experiment. Open up the file and have a look. The default set-up for the datafile is that each row will be a separate trial, and each column a piece of information about that trial. For instance the blockcode column tells you which block the trial was part of while the trialcode column tells you which type of trial was displayed.
For now, the most important columns are the response column, which indicates which key the participant pressed (as a keycode, A=30 and B=48), and the stimulusnumber1 and stimulusitem1 which tell us which stimulus was displayed on that trial. Check that the order the stimulus were displayed matches what you expected from how you defined item selection.
Most of the columns other columns give you information that should match decisions you made about the set up of your experiment, such stimulus location and trial start times.
if you ran an second participant on this Experiment, the data for the participant would be displayed in the same datafile directly underneath the current participant.
Currently, our Experiment should display all 21 stimuli in sequential order. As we saw last week, however, this could cause specific order effects.
Exercise 5a: Change this so that instead they are in random order, with no stimuli displayed twice.
Currently each trial begins immediately after the other. Let’s instead tell them they should get ready. This will require us to make 3 stages.
Exercise 5b: First, add a delay between each trial (of 500 ms).
Exercise 5c: Second, create a new text
element (e.g., labelled ready
) that determines where and
how this instruction should be displayed. To do this normally we’d
create an item
element as well, but if you only want to use
a small list of possible text strings (or in this case only one), you
can define the items directly at the items
attribute of the
text
element (e.g. /items =("Get Ready")
).
Display this in the center of the screen, like the other text, in a
smaller font.
Exercise 5d: Add ready
to the
stimulustimes attribute of the trial element.
Sometimes it can be difficult for participants to remember what the response keys they need to use.
Exercise 5e: Create a reminder that will appear at
the top of the screen on every trial of our block. This reminder should
say “Press the A key if you prefer the risky option on the left, press
the B key if you prefer the sure option on the right”. Because we want
this to be displayed on every trial in the block the appropriate place
to call this new text element is at the block level. At the block level
you can set stimuli that you want to be displayed in the background of
every trial by using the bgstim
attribute. Give it a
go.
You can send your assignment to my email address: laura.fontanesi@unibas.ch.
For this assignment, please send me the Inquisit script. If you want
to add comments, you can do that by adding the hashtag #
at
the beginning of the line.