Millisecond Forums

Select Random Trial

https://forums.millisecond.com/Topic17448.aspx

By nonamenick - 10/21/2015

Hi there,

So I am new to Inquisit and I am not even sure if this is possible, but what I'm looking to accomplish is randomly have a trial selected once all the trials have been completed. As a bit of background, the goal of this experiment is to choose between a guaranteed monetary amount and lottery where the participant has a chance to win more. There are 100+ trials all with varying lottery percentages and winning amounts, and after the experiment is over, a trial is selected at random and the participant wins the amount of money that was given to them on that specific trial. Is there any language that can allow me to do this? 

Thanks
By Dave - 10/21/2015

You need to store every trial's payout amount somewhere (in a <list> or <item> element) at runtime and then retrieve one of the entries at random at the end of the experiment. Simple example:

<values>
/ fixedwin = 100
/ randomwin = 0
/ winamount = 0
/ score = 0
</values>

<list randomwins>
/ items = (10, 25, 50, 75, 150, 300, 450, 600)
</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, score]
/ inputdevice = mouse
/ validresponse = (fixed_amount, random_amount)
/ branch = [trial.resulttrial]
</trial>

<trial resulttrial>
/ stimulusframes = [1=winamount, score]
/ validresponse = (0)
/ trialduration = 1000
</trial>

<trial payouttrial>
/ stimulusframes = [1=payoutmsg, payout, trialmsg]
/ validresponse = (57)
</trial>

<block choiceblock>
/ trials = [1-8=choicetrial]
</block>

<block payoutblock>
/ trials = [1=payouttrial]
</block>

<expt>
/ blocks = [1=choiceblock; 2=payoutblock]
</expt>

<item storedwinnings>
</item>

<text fixed_amount>
/ items = ("FIXED WIN")
/ position = (25%, 75%)
</text>

<text random_amount>
/ items = ("RANDOM WIN")
/ position = (75%, 75%)
</text>

<text question>
/ items = ("Would you like to win a FIXED or RANDOM amount?")
</text>

<text score>
/ items = ("Total: <%values.score%>")
/ position = (50%, 25%)
</text>

<text winamount>
/ items = ("You won <%values.winamount%>.")
</text>

<text payoutmsg>
/ items = ("Your payout is")
/ position = (50%, 40%)
</text>

<text payout>
/ items = storedwinnings
</text>

<text trialmsg>
/ items = ("which is the amount you won in trial #<%text.payout.currentitemnumber%>.")
/ position = (50%, 60%)
</text>