Assigning Multiple Values to One Picture


Author
Message
nonamenick
nonamenick
Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)
Group: Awaiting Activation
Posts: 20, Visits: 100

So, I'm new to inquisit and I'm having trouble with lists. The experiment involves showing many of these slides where a volunteer will pick the left side for a fixed win or the right side for a gamble. This is an example of the slide with a 25% win chance of $20:



As i have the program now, a volunteer can pick the left side and win $5, or select the left side, however I have not figured out how to get the proper percentages for the gambling tasks. Winning percentages vary from 13%,25%,38%,50% and 75%. The amount they can win varies from 5,8,25,50,125. I understand there is an itemprobabilities function under lists, I am uncertain if this would work for what I am trying to do here. 

Any help would be much appreciated!

-Nick




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: 12K, Visits: 98K
Perhaps you could attach the code you already have as well as actually spell out "the proper percentages for the gambling tasks" you want . In general, you'll want your varying winning probablilties and win amounts stored in lists in the appropriate ratio. In each "round", you'll want to sample values from those lists and store them in global variables (<values> entries) and have your trials act on those values accordingly. There are a variety of scripts in the task library that do broadly similar things, such as the CCT.

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: 12K, Visits: 98K
Here's a basic, stripped-down example that illustrates some of the mechanics one could use. There is a lot of guesswork here, because the description in your original post does not go into great detail with respect to the desired proportions, how exactly you'd want to handle probabilistic wins or losses, etc. The code below may hopefully provide some useful pointers despite those uncertainties.

<values>
/ prob = 0
/ probamount = 0
/ fixedamount = 5
/ score = 0
/ win = 0
/ randomnumber = 0
</values>

<block taskblock>
/ trials = [1-6=choicetrial]
</block>

*** Sample win probability and associated win amount from lists ***
*** Generate random number between 0-100 ***
*** If choice is probabilistic, a win occurs when win probability is greater than or equal to random number ***
<trial choicetrial>
/ ontrialbegin = [values.prob=list.winprobability.nextvalue; values.probamount=list.winamount.nextvalue; values.win=0; ]
/ ontrialbegin = [values.randomnumber = rand(0,100); ]

/ ontrialend = [if (trial.choicetrial.response=="fixed") {values.win=values.fixedamount; }; ]
/ ontrialend = [if (trial.choicetrial.response=="probabilistic" && values.prob >= values.randomnumber) {values.win=values.probamount; }; ]
/ ontrialend = [if (trial.choicetrial.response=="probabilistic" && values.prob < values.randomnumber) {values.win=0; }; ]
/ ontrialend = [values.score+=values.win; ]
/ stimulusframes = [1=fixed, probabilistic, debug]
/ inputdevice = mouse
/ validresponse = (fixed, probabilistic)
/ branch = [trial.resulttrial]
</trial>

<trial resulttrial>
/ stimulusframes = [1=resultmessage]
/ trialduration = 3000
</trial>

Lists:
*** three levels of win probability (25%, 50%, 75%) ***
*** fully crossed with two win amounts (10$ and 20$) ***
*** yielding 2 * 3 = 6 combinations ***
<list winprobability>
/ items = (25, 25, 50, 50, 75, 75)
</list>

<list winamount>
/ items = (10, 20, 10, 20, 10, 20)
/ selectionmode = list.winprobability.currentindex
</list>

<text fixed>
/ items = ("Win <%values.fixedamount%> $.")
/ position = (25%, 50%)
</text>

<text probabilistic>
/ items = ("A <%values.prob%> % chance to win <%values.probamount%> $.")
/ position = (75%, 50%)
</text>

<text resultmessage>
/ items = ("You won <%values.win%> $. Your total is <%values.score%> $.")
</text>

<text debug>
/ items = ("RNG: <%values.randomnumber%>")
/ position = (50%, 5%)
</text>


nonamenick
nonamenick
Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)
Group: Awaiting Activation
Posts: 20, Visits: 100
<values>
/ fixedwin = 5
/ randomwin = 0
/ winamount = 0
</values>

<list randomwins>
/ items = (0, 5, 8, 20, 50, 125)
</list>

<trial choicetrial>
/ ontrialbegin = [values.randomwin=list.randomwins.nextvalue]
/ ontrialend = [if (trial.choicetrial.response=="fixed_amount") values.winamount = values.fixedwin else
  values.winamount = values.randomwin; ]
/ ontrialend = [item.storedwinnings.appenditem(values.winamount); values.score+=values.winamount; ]
/ stimulusframes = [1=question,fixed_amount, random_amount, Risk_Test]
/ inputdevice = mouse
/ validresponse = (fixed_amount, random_amount)
/ branch = [trial.resulttrial]
</trial>


This is the part that I believe needs the work, the slide (Risk_Test) appears on the screen and the volunteer either selects the left side (fixed_amount) and the 5 dollars is stored, or the right side (random_amount) and it generates a random number from the values. I need the random number to be either 0 or the value pictured on the slide and the probability of that number being generated should coincide with the percentage associated with that value. 

I hope that helps explain it a little better. I will look up the CCT, are there any other tasks that would be similar?

thanks 



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: 12K, Visits: 98K
See the example code in my previous reply. That should give you the basic idea.

nonamenick
nonamenick
Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)
Group: Awaiting Activation
Posts: 20, Visits: 100
So the code has been a lot of help, the one thing that I still am having trouble doing is associating the list values with the pictures. Each picture or "slide" as it is referenced in the code, is associated with a win probability and a win amount, the win probability is the then compared to the RNG and if it is higher then the contestant wins the win amount for that slide or nothing. 

This is what I currently have: 

<picture risk_slides>
/items = ("expmnt1.png", "expmnt2.png", "expmnt3.png","expmnt4.png","expmnt5.png","expmnt6.png","expmnt7.png","expmnt8.png","expmnt9.png","expmnt10.png"
,"expmnt11.png","expmnt12.png","expmnt13.png","expmnt14.png","expmnt15.png","expmnt16.png","expmnt17.png","expmnt18.png","expmnt19.png","expmnt20.png",
"expmnt21.png","expmnt22.png","expmnt23.png","expmnt24.png","expmnt25.png","expmnt26.png","expmnt27.png","expmnt28.png","expmnt29.png","expmnt30.png"
"expmnt31.png","expmnt32.png","expmnt33.png","expmnt34.png","expmnt35.png","expmnt36.png","expmnt37.png","expmnt38.png","expmnt39.png","expmnt40.png",
"expmnt41.png","expmnt42.png","expmnt43.png","expmnt44.png","expmnt45.png","expmnt46.png","expmnt47.png","expmnt48.png","expmnt49.png","expmnt50.png")
/ size = (25%, 25%)
</picture>


<list slides>
/ selectionmode = sequence
/ selectionrate = always
/items = ("expmnt1.png", "expmnt2.png", "expmnt3.png","expmnt4.png","expmnt5.png","expmnt6.png","expmnt7.png","expmnt8.png","expmnt9.png","expmnt10.png",
"expmnt11.png","expmnt12.png","expmnt13.png","expmnt14.png","expmnt15.png","expmnt16.png","expmnt17.png","expmnt18.png","expmnt19.png","expmnt20.png",
"expmnt21.png","expmnt22.png","expmnt23.png","expmnt24.png","expmnt25.png","expmnt26.png","expmnt27.png","expmnt28.png","expmnt29.png","expmnt30.png",
"expmnt31.png","expmnt32.png","expmnt33.png","expmnt34.png","expmnt35.png","expmnt36.png","expmnt37.png","expmnt38.png","expmnt39.png","expmnt40.png",
"expmnt41.png","expmnt42.png","expmnt43.png","expmnt44.png","expmnt45.png","expmnt46.png","expmnt47.png","expmnt48.png","expmnt49.png","expmnt50.png")
</list>


<list slidevalues>
/ items = (5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,
    5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125)
/selectionmode = list.slides.currentindex
/selectionrate = always
</list>
****list.slides.currentindex

<list slideprob>
/ items = (13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75,
13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75)
/selectionmode = list.slides.currentindex
/selectionrate = always
</list>
*******list.slides.currentindex

<values>
/ prob = 0
/ probamount = 0
/ fixedamount = 5
/ score = 0
/ win = 0
/ randomnumber = 0
/ slidevalues = 0
</values>
<trial choicetrial>
/ ontrialbegin = [values.prob=list.slideprob.nextvalue; values.probamount=list.slidevalues.nextvalue; values.win=0; ]
/ ontrialbegin = [values.randomnumber = rand(0,100); ]
/ontrialbegin = [picture.risk_slides]
ontrialbegin = [picture.risk_slides.item.1 = list.slides.nextvalue; ]

/ ontrialend = [if (trial.choicetrial.response=="fixed") {values.win=values.fixedamount; }; ]
/ ontrialend = [if (trial.choicetrial.response=="probabilistic" && values.prob >= values.randomnumber) {values.win=values.probamount; }; ]
/ ontrialend = [if (trial.choicetrial.response=="probabilistic" && values.prob < values.randomnumber) {values.win=0; }; ]
/ ontrialend = [values.score+=values.win; ]
/ stimulusframes = [1=fixed, probabilistic, debug, risk_slides]
/ inputdevice = mouse
/ validresponse = (fixed, probabilistic)
/ branch = [trial.resulttrial]
</trial>


********************************************************************************************************

I am trying to get the two lists (slidevalues and slideprob) to match up with the pictures in the slides list. That way when the trial randomly generates a "slide" the win value and probability are the same as what is shown in the slide/picture. A similar program to what i'm trying to do is the Black Jack program, with each card of the deck given a value. I am just having trouble figuring this out. 

Any help would again be much appreciated,
Thanks.





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: 12K, Visits: 98K
#1: I don't understand the purpose of <list slides>. It isn't used anywhere in the code -- nowhere is a value from it ever sampled. And yet you have the selection in <list slidevalues> and <list slideprob> depend on it. That does not make sense.

#2: All you need to do is set <list slidevalues> to the desired selection mode -- if you want random sampling set it to random. If you want sequential selection, set it to sequence.

<list slidevalues>
/ items = (5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,
    5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125)
/selectionmode = random
</list>

Then, selection in <list slideprob> *as well as* in <picture risk_slides> simply need to depend on the selection in <list slidevalues>:

<list slideprob>
/ items = (13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75,
13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75)
/selectionmode = list.slidevalues.currentindex
</list>

<picture risk_slides>
/items = ("expmnt1.png", "expmnt2.png", "expmnt3.png","expmnt4.png","expmnt5.png","expmnt6.png","expmnt7.png","expmnt8.png","expmnt9.png","expmnt10.png"
,"expmnt11.png","expmnt12.png","expmnt13.png","expmnt14.png","expmnt15.png","expmnt16.png","expmnt17.png","expmnt18.png","expmnt19.png","expmnt20.png",
"expmnt21.png","expmnt22.png","expmnt23.png","expmnt24.png","expmnt25.png","expmnt26.png","expmnt27.png","expmnt28.png","expmnt29.png","expmnt30.png"
"expmnt31.png","expmnt32.png","expmnt33.png","expmnt34.png","expmnt35.png","expmnt36.png","expmnt37.png","expmnt38.png","expmnt39.png","expmnt40.png",
"expmnt41.png","expmnt42.png","expmnt43.png","expmnt44.png","expmnt45.png","expmnt46.png","expmnt47.png","expmnt48.png","expmnt49.png","expmnt50.png")
/ size = (25%, 25%)
/ select = list.slidevalues.currentindex
</picture>

This is essentially what you'll also find covered in the "How to display stimulus pairs" topic in the Inquisit documentation.

nonamenick
nonamenick
Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)Distinguished Member (3K reputation)
Group: Awaiting Activation
Posts: 20, Visits: 100
I guess that slides list was unnecessary with the picture = risk_slides so I removed it with no changes to the program. The other changes to the selection modes worked great. the win amounts match with the slide values but the probability is off by one. I ran the program in sequence to test the numbers and in the first trial the percentage is blank and the percentages values get pushed back one spot. 

this is how the text appears on the screen.

<text probabilistic>
/ items = ("A <%values.prob%> % chance to win <%values.probamount%> $.")
/ position = (75%, 50%)
</text>

<trial choicetrial>
/ ontrialbegin = [values.prob=list.slideprob.nextvalue; values.probamount=list.slidevalues.nextvalue; values.win=0; ]

I think it must have to do with this line here, maybe that nextvalue is what is causing this problem? 

 
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: 12K, Visits: 98K
If you reverse the order in which you sample from

<trial choicetrial>
/ ontrialbegin = [values.prob=list.slideprob.nextvalue; values.probamount=list.slidevalues.nextvalue; values.win=0; ]
...
</trial>

to

<trial choicetrial>
/ ontrialbegin = [values.probamount=list.slidevalues.nextvalue; values.prob=list.slideprob.nextvalue; values.win=0; ]
...
</trial>

it'll work. Selection in <list slideprob> and <picture risk_slides> *depend on* selection in <list slidevalues>, i.e. the very first thing you need to do is sample from <list slidevalues>.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search