Iowa Gambling Task Variant


Author
Message
MiskatonicStudent
MiskatonicStudent
Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 22
Hello,

I'm trying to adapt the script for the Iowa Gambling Task to run the variant version of this task where participants lose money every time they select a card and receive audio feedback. I've been trying to make it so participants can run out of cards from a deck if they select 60 cards from the deck but have not been successful (please note in the script I pasted below I set the limit of cards per deck as 2 for testing purposes.) I've tried using the removestimulusframes attribute but it doesn't appear to be working when I set it to remove one of the deck pictures (if i set it to remove one of the labels on the screen, however, it appears to work.) I also tried using the validreponse attribute but I do not know how to set it to allow for some responses to be valid but not others. I have pasted my entire script below and would really appreciate any feedback. Thank you.

**************************************************************************************************************
**************************************************************************************************************
                                       IOWA GAMBLING TASK
**************************************************************************************************************
**************************************************************************************************************

**************************************************************************************************************
**************************************************************************************************************
                                          SCRIPT INFO

last updated: 3-13-2012
modified: 06-11-2014 - XXXXXXX modified this script to resemble the IGT variant (see Bechara et. al. 2000).
                       These modifications include: 
                        - changed each card selection to a loss with occasional gains
                        - increased the number of trials to 100   
                        - added audio feedback upon the end of each trial. 
For the original script see the 
                       milisecond website : http://www.millisecond.com/download/library/IowaGamblingTask/
**************************************************************************************************************
**************************************************************************************************************
                                       BACKGROUND INFO
**************************************************************************************************************
**************************************************************************************************************
This sample script originally showed how to implement the Iowa Gambling Task as described in:

Bechara A., Damasio A. R., Damasio H., Anderson S. W. (1994). 
Insensitivity to future consequences following damage to human prefrontal cortex. Cognition, 50, 7-15 .

This script has been modified to implement Iowa Gambling Task Variant as described in:

Bechara, A., Tranel, D., & Damasio, H. (2000). 
Characterization of the decision-making deficit of patients with ventromedial prefrontal cortex lesions. 
Brain, 123(11), 2189-2202.

**************************************************************************************************************
**************************************************************************************************************
                                    DEFAULT SCREEN SETTING
**************************************************************************************************************
**************************************************************************************************************
<defaults>
/ minimumversion = "3.0.1.0"
/ inputdevice = mouse
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
</defaults>
**************************************************************************************************************
**************************************************************************************************************
                                             VALUES
**************************************************************************************************************
**************************************************************************************************************
****************
editable parameters: can be edited by experimenter
****************
currenttotal:                     the amount of money currently owned
                                 startamount (default) = 2000

***************
the remaining parameters are updated automatically during runtime
***************
previoustotal:                  the previous amount of money owned
cardselected:                  adds the number of cards selected
gain:                        stores the trial's gain depending on choice
loss:                         stores the trial's loss depending on choice
groupnumber:                  the groupnumber (1-4) the subject was randomly assigned to      *(I took this out because it was somehow effecting the loss values I assigned to each deck)         

<values>
/ currenttotal = 2000

/ previoustotal = 0
/ cardsselected = 0
/ deckEselected = 0
/ deckFselected = 0
/ deckGselected = 0
/ deckHselected = 0
/ gain = 0
/ loss = 0
</values>
**************************************************************************************************************
**************************************************************************************************************
                                          EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************
<expressions>
/ getgaindeck1 = noreplace(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1250, 1250, 1250, 1250)
/ getgaindeck2 = noreplace(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 50, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75, 75, 75)
/ getgaindeck3 = noreplace(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 150, 150, 150, 200, 200, 200, 200, 200, 250, 250, 250, 300, 300, 300, 350, 350, 350, 350, 350)
/ getgaindeck4 = noreplace(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 250, 250, 250)
</expressions>
**************************************************************************************************************
**************************************************************************************************************
                                          EXPRESSIONS
**************************************************************************************************************
**************************************************************************************************************




**************************************************************************************************************
**************************************************************************************************************
                                             DATA
**************************************************************************************************************
**************************************************************************************************************
<data>
/ columns = [date, time, subject, values.cardsselected, values.deckEselected, values.deckFselected, values.deckGselected,values.deckhselected, response, latency, 
               values.loss, values.gain, values.currenttotal]
/ separatefiles = true

/ labels = true
</data>
**************************************************************************************************************
**************************************************************************************************************
                                 INSTRUCTIONS ELEMENTS
**************************************************************************************************************
**************************************************************************************************************

****************************************************
NOTE: instructions can be changed here:

<item instructions>
/ 1 = "In this experiment, you will be asked to repeatedly select a card from one of the four decks above. You can select a card by clicking the mouse on one of decks.

With each card, you will lose some money, but you can also win some. Some decks will be more profitable than others. Try to choose cards from most profitable decks so that your total winnings will be as high as possible. 

You will get <% block.igt.trialscount%> chances to select a card from the deck that you think will give you the highest winnings. Your total earnings and the number of cards selected will be displayed on screen. 

You start with $<%values.currenttotal%>. Click ~"Start~" to begin."
/ 2 = "Select a card."
</item>

****************************************************
<text igtinstructions>
/ items = instructions
/ select = 1
/ position = (50%, 60%)
/ fontstyle = ("Arial", 1.75%)
/ size = (80%, 30%)
/ hjustify = left
/ valign = top
</text>

<trial instructions>
/ stimulusframes = [1=igt, deck1, deck2, deck3, deck4, deck1label, deck2label, deck3label, deck4label, igtinstructions, start]
/ validresponse = (start)
/ recorddata = false
</trial>

<block instructions>
/ trials = [1=instructions]
</block>
**************************************************************************************************************
**************************************************************************************************************
                                          STIMULI
**************************************************************************************************************
**************************************************************************************************************
<text cardsselected>
/ items = ("Cards selected: <% values.cardsselected %> of <% block.igt.trialscount%>")
/ position = (50%, 10%)
/ fontstyle = ("Arial", 2%)
/ erase = false
</text>

<text start>
/ items = ("Start")
/ position = (50%, 90%)
/ fontstyle = ("Arial", 3%, false, false, true, false, 5, 0)
/ txcolor = blue
</text>

<text continue>
/ items = ("Continue")
/ position = (50%, 65%)
/ fontstyle = ("Arial", 3%, false, false, true, false, 5, 0)
/ txcolor = blue
</text>

<text gain>
/ items = ("You won $<% values.gain%>")
/ position = (20%, 55%)
/ valign = top
/ txcolor = green
</text>

<text loss>
/ items = ("You lost $<% values.loss%>")
/ position = (20%, 51%)
/ valign = top
/ txcolor = red
</text>

<text previoustotal>
/ items = ("   Previous total: $<% values.previoustotal %>   ")
/ position = (50%, 18%)
/ erase = false
</text>

<text currenttotal>
/ items = ("   Current total: $<% values.currenttotal %>   ")
/ position = (50%, 22%)
/ erase = false
</text>

<text igt>
/ items = ("Iowa Gambling Test")
/ position = (50%, 10%)
/ fontstyle = ("Arial", 4%)
/ erase = false
</text>

<text selectinstructions>
/ items = instructions
/ select = 2
/ position = (50%, 65%)
</text>

<picture deck1>
/ items = ("deck.jpg")
/ position = (20%, 50%)
/ valign = bottom
/ erase = false
/ size = (20%, 20%)
</picture>

<text deck1label>
/ items = ("Deck E")
/ position = (20%,51%)
/ valign = top
/ erase = false
</text>

<picture deck2>
/ items = ("deck.jpg")
/ position = (40%, 50%)
/ valign = bottom
/ erase = false
/ size = (20%, 20%)
</picture>

<text deck2label>
/ items = ("Deck F")
/ position = (40%,51%)
/ valign = top
/ erase = false
</text>

<picture deck3>
/ items = ("deck.jpg")
/ position = (60%, 50%)
/ valign = bottom
/ erase = false
/ size = (20%, 20%)
</picture>

<text deck3label>
/ items = ("Deck G")
/ position = (60%,51%)
/ valign = top
/ erase = false
</text>

<picture deck4>
/ items = ("deck.jpg")
/ position = (80%, 50%)
/ valign = bottom
/ erase = false
/ size = (20%, 20%)
</picture>

<text deck4label>
/ items = ("Deck H")
/ position = (80%,51%)
/ valign = top
/ erase = false
</text>

<picture deckon>
/ items = ("deckon.jpg")
/ erase = false
</picture>

<sound losesound1>
/ items = ("losesound1.wav", "losesound2.wav", "losesound3.wav", "losesound5.wav", "losesound6.wav")
/ playthrough = true
/ select = noreplace
</sound>


<sound losesound4>
/ items = ("losesound4.wav")
/ playthrough = true
/ select = noreplace
</sound>

<sound winsound1>
/items = ("winsound1.wav", "winsound2.wav", "winsound3.wav", "winsound4.wav", "winsound5.wav", "winsound6.wav")
/ playthrough = true
/ select = noreplace
</sound>

**************************************************************************************************************
**************************************************************************************************************
                                          MAIN TRIALS
**************************************************************************************************************
**************************************************************************************************************

07/02/2014 - I've tried moving "selectinstructions" to stim 1 and it still gets removed...so for some reason the deck images are not being recognized as stimulusframes?

<trial igt>
/ stimulusframes = [1=deck1; 2=deck2; 3=deck3; 4=deck4; 5=deck1label; 6=deck2label; 7=deck3label; 8=deck4label; 9=selectinstructions]
/ ontrialbegin = [if (values.deckEselected>=2){trial.igt.removestimulusframe(1);}]
/ ontrialbegin = [if (values.deckFselected>=2){trial.igt.removestimulusframe(2);}]
/ ontrialbegin = [if (values.deckGselected>=2){trial.igt.removestimulusframe(3);}]
/ ontrialbegin = [if (values.deckHselected>=2){trial.igt.removestimulusframe(4);}]
/ validresponse = (deck1, deck2, deck3, deck4)
/ branch = [if (values.gain != 0) trial.igtfeedbackgain]
/ branch = [if (values.loss != 0) trial.igtfeedbackloss]
/ ontrialend = [values.cardsselected = values.cardsselected + 1]
/ ontrialend = [ if (trial.igt.response == "deck1") {values.deckEselected = values.deckEselected + 1}]
/ ontrialend = [ if (trial.igt.response == "deck2") {values.deckFselected = values.deckFselected + 1}]
/ ontrialend = [ if (trial.igt.response == "deck3") {values.deckGselected = values.deckGselected + 1}]
/ ontrialend = [ if (trial.igt.response == "deck4") {values.deckHselected = values.deckHselected + 1}]
/ ontrialend = [ if (trial.igt.response == "deck1") {picture.deck1.item.1 = "deckon.jpg"; text.gain.hposition=picture.deck1.hposition; text.loss.hposition=picture.deck1.hposition; values.loss=100; values.gain=expressions.getgaindeck1; values.previoustotal=values.currenttotal; values.currenttotal = values.currenttotal-values.loss+values.gain;}]
/ ontrialend = [ if (trial.igt.response == "deck2") {picture.deck2.item.1 = "deckon.jpg"; text.gain.hposition=picture.deck2.hposition; text.loss.hposition=picture.deck2.hposition; values.loss=50; values.gain=expressions.getgaindeck2; values.previoustotal=values.currenttotal; values.currenttotal = values.currenttotal-values.loss+values.gain;}]
/ ontrialend = [ if (trial.igt.response == "deck3") {picture.deck3.item.1 = "deckon.jpg"; text.gain.hposition=picture.deck3.hposition; text.loss.hposition=picture.deck3.hposition; values.loss=100; values.gain=expressions.getgaindeck3; values.previoustotal=values.currenttotal; values.currenttotal = values.currenttotal-values.loss+values.gain;}]
/ ontrialend = [ if (trial.igt.response == "deck4") {picture.deck4.item.1 = "deckon.jpg"; text.gain.hposition=picture.deck4.hposition; text.loss.hposition=picture.deck4.hposition; values.loss=50; values.gain=expressions.getgaindeck4; values.previoustotal=values.currenttotal; values.currenttotal = values.currenttotal-values.loss+values.gain;}]
</trial>


<trial igtfeedbackloss>
/ ontrialbegin = [if(values.deckEselected>=2){trial.igtfeedbackloss.removestimulusframe(2)};]
/ stimulusframes = [1=losesound1, deck1, deck2, deck3, deck4, gain, loss, previoustotal, currenttotal, cardsselected]
/ trialduration = 6000
/ recorddata = false

</trial>


<trial igtfeedbackgain>
/ ontrialbegin = [if(values.deckEselected >= 2){trial.igtfeedbackgain.removestimulusframe(2)};]
/ stimulusframes = [1=losesound4, deck1, deck2, deck3, deck4, gain, loss, previoustotal, currenttotal, cardsselected]
/ trialduration = 6000
/ recorddata = false

</trial>

**************************************************************************************************************
**************************************************************************************************************
                                          MAIN BLOCK
**************************************************************************************************************
**************************************************************************************************************

<block igt>
/ trials = [1-100 = igt]
</block>
**************************************************************************************************************
**************************************************************************************************************
                                          EXPERIMENT
**************************************************************************************************************
**************************************************************************************************************
<expt main>
/ blocks = [1=instructions; 2=igt]
</expt>

**************************************************************************************************************
**************************************************************************************************************
                                          End of Script
**************************************************************************************************************
**************************************************************************************************************


Edited 11 Years Ago by MiskatonicStudent
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
> I also tried using the validreponse attribute but I do not know how to set it to allow for some responses to be valid but not others.

You cannot do that with the /validresponse attribute. You need to use /isvalidresponse instead to invalidate a given repsonse option if a certain condition is met:

<trial igt>
...
/ validresponse = (deck1, deck2, deck3, deck4)
/ isvalidresponse = [values.deckEselected<2 && trial.igt.response=="deck1"]
/ isvalidresponse = [values.deckFselected<2 && trial.igt.response=="deck2"]
/ isvalidresponse = [values.deckGselected<2 && trial.igt.response=="deck3"]
/ isvalidresponse = [values.deckHselected<2 && trial.igt.response=="deck4"]
...

</trial>

> I've tried using the removestimulusframes attribute but it doesn't appear to be working when I set it to remove one of the deck pictures

It is working just fine, but since the stimuli in question are set to *not* be erased

<picture deck1>
/ items = ("deck.jpg")
/ position = (20%, 50%)
/ valign = bottom
/ erase = false
/ size = (20%, 20%)
</picture>

they won't magically disappear from the screen. The removal of the respective stimulusframe

<trial igt>
/ stimulusframes = [1=deck1; 2=deck2; 3=deck3; 4=deck4; 5=deck1label; 6=deck2label; 7=deck3label; 8=deck4label; 9=selectinstructions]
/ ontrialbegin = [if (values.deckEselected>=2){trial.igt.removestimulusframe(1);}]
/ ontrialbegin = [if (values.deckFselected>=2){trial.igt.removestimulusframe(2);}]
/ ontrialbegin = [if (values.deckGselected>=2){trial.igt.removestimulusframe(3);}]
/ ontrialbegin = [if (values.deckHselected>=2){trial.igt.removestimulusframe(4);}]
...
</trial>

merely means that the *next* instance of the <trial> will *not* (re-)draw that frame anymore.

The removal of the labels only "works" because they get overwritten by <text gain> and <text loss> at some point. Thus you are able to notice that they are not re-drawn.

My personal opinion is that you should ditch the removestimulusframe() approach. Instead create a blank white jpg the size of the other card images and set the deck picture to that blank image when your card selection threshold is met (just like you set a deck to "deckon.jpg" in case of a selection of that deck).

Edited 11 Years Ago by Dave
MiskatonicStudent
MiskatonicStudent
Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 22
This works perfectly in Inquisit 4. Thank you so much!

The only downside is it does not seem to work in Inquisit 3. When I try to run it I get this error message:

<trial igt>
 Expression 'if (values.deckeselected>=60){trial.igt.removestimulusframe(5);}' is invalid. Item not found.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
That's because those functions do not exist in Inquisit 3.

MiskatonicStudent
MiskatonicStudent
Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 22
Makes sense. Thank you again!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
NB: The alternative approach outlined in my 1st reply is perfectly applicable to Inquisit 3, as it does not require the removestimulusframe() function.

MiskatonicStudent
MiskatonicStudent
Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 22
Yes, this is working in Inquisit 3 as you said.

I'm curious if there is a way to make it so that when participants click on where the deck used to be it does not count as a response. As it is now, the image of the deck goes away once the threshold is reached but click in the place where it was results in a selection from that deck. 

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
Proper /isvalidresponse logic as detailed in the 1st response should prevent that from happening.

MiskatonicStudent
MiskatonicStudent
Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)Respected Member (402 reputation)
Group: Awaiting Activation
Posts: 5, Visits: 22
...you are right. I feel so dumb. Thank you for your help and for being patient with me. 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
No problem at all -- good to hear it's working now!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search