Millisecond Forums

Noreplace behavior

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

By mzhang13 - 3/29/2017

I'm a bit confused how the behavior of noreplace works. I set up my experiment such that the number of items per type of trial should add up to the number of trials I'm asking the block to fill. In the below example, shopping_trial has 14 unique trials, discount_trial has 6 unique trials, and gender_trial has 8 unique trials. Trials are set up to run paired stimuli (using the index selected of 1 of the stimuli), with the base stimuli being set to noreplace. However, when this runs, it seems to ignore the noreplace, duplicating some of these trials and not reaching the full 14 shopping trials (presumably, there's a 33% chance of each trial occurring regardless of the replacement status).

Here is some abridged code to show how this is set up:

<item discount1>
/1 = "Stimuli/sprite.jpg"
/2 = "Stimuli/tropicana_oj.jpg"

/3 = "Stimuli/philadelphia_cream_cheese.jpg"
/4 = "Stimuli/store_paper_towels.png"

/5 = "Stimuli/chicken_breast2.jpg"
/6 = "Stimuli/strawberries2.jpg"
</item>

<picture discount1>
/ items = discount1
/ select = noreplace
</picture>

<picture discount2>
/ items = discount2
/ select = current(discount1)
</picture>

<trial discount_trial>
/ stimulusframes = [1 = discount1, discount2]
</trial>

--------------------------

<block november>
/ bgstim = (zreminder, mreminder)
/ trials = [1-28 = noreplace(shopping_trial, discount_trial, gender_trial)]
/ errormessage = false
</block>

Is there any way to make it pick exactly 14, 6, and 8, while also forcing it to randomize the order of the presentation of these trials?
By mzhang13 - 3/29/2017

Update: Think I figured out by manually making a list and using that instead:

<list november_list>
/ items = (trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial,
trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial)
/ poolsize = 28
</list>

<block november>
/ bgstim = (zreminder, mreminder)
/ trials = [1-28 = list.november_list]
/ errormessage = false
</block>
By Dave - 3/29/2017

mzhang13 - Wednesday, March 29, 2017
Update: Think I figured out by manually making a list and using that instead:

<list november_list>
/ items = (trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial, trial.shopping_trial,
trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.discount_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial, trial.gender_trial)
/ poolsize = 28
</list>

<block november>
/ bgstim = (zreminder, mreminder)
/ trials = [1-28 = list.november_list]
/ errormessage = false
</block>

To elaborate on this and provide an explanation: Sampling *stimuli* and sampling *trials* are two separate things:

<text mytext>
/ items = ("A", "B", "C")
/ select = noreplace
</text>

will sample from the 3 items randomly, without replacement. I.e. if you run

<trial mytrial>
/ stimulusframes = [1=mytext]
...
</trial>

three times

<block myblock>
/ trials = [1-3 = mytrial]
</block>

you'll end up seeing A once, B once, and C once.

Now, what noreplace() in a <block>'s /trials attribute does is sample from *<trial>* elements. What matters here are the proportions entered into the noreplace() selection pool.

<block myblock>
/ trials = [1-12 = noreplace(atrial, btrial, ctrial)]
</block>

means sample the three trial elements -- atrial, btrial, ctrial -- in *equal* proportions. You'll end up with
- 4 x atrial,
- 4 x btrial, and
- 4 x ctrial
in random order.

With

<block myblock>
/ trials = [1-12 = noreplace(atrial, btrial, ctrial, ctrial)]
</block>

you would end up with *twice* as many ctrials compared to atrials and btrials, i.e.
- 3 x atrial,
- 3 x btrial, and
- 6 x ctrial
in random order.

In other words, you need to enter the correct amount of each trial-type into the selection pool. Hope this clarifies.