Millisecond Forums

Random duration of trial

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

By ***JayD*** - 5/12/2016

Hi,

I have a couple of questions

1) Is it possible to randomize a trial's duration (either using /trialduration or /response = timeout ())? I want to try and have my intertrial interval randomly vary between 500ms and 400ms on any given trial.

2) I want a particular (mouse-click) response to give participants a 'reward' feedback trial on 80% of trials, while presenting the same mouse-click with a different 'no-reward' feedback trial on the other 20%. I'm not sure how to go about building in these percentages into the branch trials. What's the best way to do this?

Thanks,

Jay
By Dave - 5/12/2016

Re. #1: Yes. You can do something like

<values>
/ randomiti = 0
...
</values>

with

<trial iti>
/ ontrialbegin = [values.randomiti = round(rand(400,500))]
...
/ trialduration = values.randomiti
...
</trial>

/pre- and /posttrialpause, /timeout and /trialduration all accept values which you can set at will via /ontrialbegin etc.

For the relationship between the various timing components involved in a <trial> see the "How to Control Trial Duration and Inter-Trial Intervals" topic in the documentation.

Re. #2: Not sure why you would need any elaborate /branch logic, but the question is underspecified. For example, it's not clear if the "specific response" is the only allowed response; if not, you cannot possibly know how many times a participant will actually provide the "specific response", i.e., it may not even be possible to achieve the 80/20 split. Suppose the participant only provides the "specific" response twice across however many trials you have: You could at best achieve a 50/50 split in that situation.

If, otoh, there is only that single "specific response", you can simply do

<block someblock>
/ trials = [1-10 = noreplace(rewardtrial, rewardtrial, rewardtrial, rewardtrial, norewardtrial)]
...
</block>

which will run 8 "reward" trials and 2 "no reward" trials. No branching required.