repeating a trial: loop


Author
Message
Helena_BLACKMORE
Helena_BLACKMORE
Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)
Group: Forum Members
Posts: 5, Visits: 54
Hello!

I am looking for help with creating a repeating trial with some changes depending on answer in a previous trial.
Ideally I wouldlike tocreate a loop, but couldn't find a simpleway to do it in Inquisit.

I have done the following:
<parameters>
/responsekey_beer = "b"
/responsekey_NA = "n"
</parameters>

<values>
/incentive= 50
/count= 0
/increment=0
</values>

<list increment>
/ items = (25, 12.50, 6.25, 3.10, 1.55, 0.75, 0.40, 0.20, 0.10, 0.05, 0.05, 0.01, 0.01, 0.01, 0.01)
/ selectionmode = sequence
</list>

<trial trial_e>
/ ontrialbegin = [values.increment=list.increment.nextindex]
/ stimulusframes = [1=beer,NA, taskinstruct1, taskinstruct2]
/ recorddata = true
/ validresponse = ("b", "n")
/ correctresponse = ("b")
/ ontrialend = [if (trial.trial_e.correct==TRUE ) values.incentive = values.incentive + values.increment]
/ ontrialend = [if (trial.trial_e.correct==FALSE) values.incentive = values.incentive - values.increment]
/ ontrialend = [values.count=values.count+1]
/ ontrialend = [if (values.count < 15) trial.trial_e]
</trial>


<block experiment>
/ trials = [1=trial_e]
/ postinstructions = (page.end)
</block>


However, this does not seem to work, the trial runs once only. I am not sure where am I going wrong. Any ideas? I would appreciate any help/tips.
Thank you!

Helena

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: 105K
Helena_BLACKMORE - 3/12/2021
Hello!

I am looking for help with creating a repeating trial with some changes depending on answer in a previous trial.
Ideally I wouldlike tocreate a loop, but couldn't find a simpleway to do it in Inquisit.

I have done the following:
<parameters>
/responsekey_beer = "b"
/responsekey_NA = "n"
</parameters>

<values>
/incentive= 50
/count= 0
/increment=0
</values>

<list increment>
/ items = (25, 12.50, 6.25, 3.10, 1.55, 0.75, 0.40, 0.20, 0.10, 0.05, 0.05, 0.01, 0.01, 0.01, 0.01)
/ selectionmode = sequence
</list>

<trial trial_e>
/ ontrialbegin = [values.increment=list.increment.nextindex]
/ stimulusframes = [1=beer,NA, taskinstruct1, taskinstruct2]
/ recorddata = true
/ validresponse = ("b", "n")
/ correctresponse = ("b")
/ ontrialend = [if (trial.trial_e.correct==TRUE ) values.incentive = values.incentive + values.increment]
/ ontrialend = [if (trial.trial_e.correct==FALSE) values.incentive = values.incentive - values.increment]
/ ontrialend = [values.count=values.count+1]
/ ontrialend = [if (values.count < 15) trial.trial_e]
</trial>


<block experiment>
/ trials = [1=trial_e]
/ postinstructions = (page.end)
</block>


However, this does not seem to work, the trial runs once only. I am not sure where am I going wrong. Any ideas? I would appreciate any help/tips.
Thank you!

Helena

/ ontrialend = [if (values.count < 15) trial.trial_e]

needs to be a /branch, not an /ontrialend statement:

/ branch = [if (values.count < 15) trial.trial_e]

Helena_BLACKMORE
Helena_BLACKMORE
Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)
Group: Forum Members
Posts: 5, Visits: 54
Thank you somuch for your help, the looping works now, however it reveaed another issue. 
1. based on  answer in previous trial (trial.check) ,I want to skip a trial (e_trial.trial), but this does not seem to work.
2. an  incentive is presented during each run of the trial. The incentive value is adjusted by a specific increment (value.increment) according to a list I created (list.increment). Strangely, the incentive value gets adjusted, but not according to the list of increments. 

I spent several hours trying to solve this, but cannot see what's wrong. I would appreciate any assistance.

Thank you,

Helena



<values>
/incentive= 50
/count= 0
/increment=0
</values>

<list increment>
/ items = (25, 12.50, 6.25, 3.10, 1.55, 0.75, 0.40, 0.20, 0.10, 0.05, 0.02, 0.01, 0.005)
/ selectionmode = sequence
</list>

<trial check>
/ stimulusframes = [1=feedback, beer, NA_base, or, click, question]
/ inputdevice=mouse
/ validresponse = (text.NA_base, text.beer)
/ beginresponsetime = 0
/ recorddata = true
</trial>
<trial trial_e>
/ skip = [trial.check.response==text.NA_base]
/ beginresponsetime = 0
/ ontrialbegin = [values.increment=list.increment.nextindex]
...
/ inputdevice=mouse
/ validresponse = (text.NA,text.beer)
/ correctresponse=(text.beer)
/ ontrialend = [if (trial.trial_e.correct==TRUE ) values.incentive = values.incentive + values.increment]
/ ontrialend = [if (trial.trial_e.correct==FALSE) values.incentive = values.incentive - values.increment]
/ ontrialend = [values.count=values.count+1]
/ branch = [if (values.count < 13) trial.trial_e]
</trial>

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: 105K
Helena_BLACKMORE - 3/13/2021
Thank you somuch for your help, the looping works now, however it reveaed another issue. 
1. based on  answer in previous trial (trial.check) ,I want to skip a trial (e_trial.trial), but this does not seem to work.
2. an  incentive is presented during each run of the trial. The incentive value is adjusted by a specific increment (value.increment) according to a list I created (list.increment). Strangely, the incentive value gets adjusted, but not according to the list of increments. 

I spent several hours trying to solve this, but cannot see what's wrong. I would appreciate any assistance.

Thank you,

Helena



<values>
/incentive= 50
/count= 0
/increment=0
</values>

<list increment>
/ items = (25, 12.50, 6.25, 3.10, 1.55, 0.75, 0.40, 0.20, 0.10, 0.05, 0.02, 0.01, 0.005)
/ selectionmode = sequence
</list>

<trial check>
/ stimulusframes = [1=feedback, beer, NA_base, or, click, question]
/ inputdevice=mouse
/ validresponse = (text.NA_base, text.beer)
/ beginresponsetime = 0
/ recorddata = true
</trial>
<trial trial_e>
/ skip = [trial.check.response==text.NA_base]
/ beginresponsetime = 0
/ ontrialbegin = [values.increment=list.increment.nextindex]
...
/ inputdevice=mouse
/ validresponse = (text.NA,text.beer)
/ correctresponse=(text.beer)
/ ontrialend = [if (trial.trial_e.correct==TRUE ) values.incentive = values.incentive + values.increment]
/ ontrialend = [if (trial.trial_e.correct==FALSE) values.incentive = values.incentive - values.increment]
/ ontrialend = [values.count=values.count+1]
/ branch = [if (values.count < 13) trial.trial_e]
</trial>

The /skip needs to read

/ skip = [trial.check.response=="NA_base"]

Regarding the increment, be clearer, please. Why do you believe it is not adjusted by the selected increment and how did you determine that? Provide data showing the issue.

Also, please provide runnable code, i.e. code that contains everything it needs to run. The snippets you provided above are not useful in isolation.
Helena_BLACKMORE
Helena_BLACKMORE
Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)Associate Member (74 reputation)
Group: Forum Members
Posts: 5, Visits: 54
Dave - 3/15/2021
Helena_BLACKMORE - 3/13/2021
Thank you somuch for your help, the looping works now, however it reveaed another issue. 
1. based on  answer in previous trial (trial.check) ,I want to skip a trial (e_trial.trial), but this does not seem to work.
2. an  incentive is presented during each run of the trial. The incentive value is adjusted by a specific increment (value.increment) according to a list I created (list.increment). Strangely, the incentive value gets adjusted, but not according to the list of increments. 

I spent several hours trying to solve this, but cannot see what's wrong. I would appreciate any assistance.

Thank you,

Helena



<values>
/incentive= 50
/count= 0
/increment=0
</values>

<list increment>
/ items = (25, 12.50, 6.25, 3.10, 1.55, 0.75, 0.40, 0.20, 0.10, 0.05, 0.02, 0.01, 0.005)
/ selectionmode = sequence
</list>

<trial check>
/ stimulusframes = [1=feedback, beer, NA_base, or, click, question]
/ inputdevice=mouse
/ validresponse = (text.NA_base, text.beer)
/ beginresponsetime = 0
/ recorddata = true
</trial>
<trial trial_e>
/ skip = [trial.check.response==text.NA_base]
/ beginresponsetime = 0
/ ontrialbegin = [values.increment=list.increment.nextindex]
...
/ inputdevice=mouse
/ validresponse = (text.NA,text.beer)
/ correctresponse=(text.beer)
/ ontrialend = [if (trial.trial_e.correct==TRUE ) values.incentive = values.incentive + values.increment]
/ ontrialend = [if (trial.trial_e.correct==FALSE) values.incentive = values.incentive - values.increment]
/ ontrialend = [values.count=values.count+1]
/ branch = [if (values.count < 13) trial.trial_e]
</trial>

The /skip needs to read

/ skip = [trial.check.response=="NA_base"]

Regarding the increment, be clearer, please. Why do you believe it is not adjusted by the selected increment and how did you determine that? Provide data showing the issue.

Also, please provide runnable code, i.e. code that contains everything it needs to run. The snippets you provided above are not useful in isolation.

Thank you again for your help.

The skip command now works.

I also managed to fix the changing increments: the issue was caused by calling .nextindex instead of .nextvalue.

Thanks again!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search