noreplacenorepeat for unequal number of trials


Author
Message
writekristin
writekristin
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 17, Visits: 62
I am trying to write an experiment that has four trials but I want to run two of the trials twice as many times as two of the others.

i.e. run each trial this number of times:
trial1:12
trial2:24
trial3:24
trial4:12

In order to do this, I know I need to do noreplace(trial1, trial2, trial2, trial3, trial3, trial4), however I also don't want the same trial to run consecutively.  Unfortunately, noreplacenorepeat(trial1, trial2, trial2, trial3, trial3, trial4) does not seem to accomplish this!  Now it runs in the right proportions, but it will happen where I get for example: trial2, trial2, trial2.  

Any advice? :(
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: 100K
You need to set up a <list> element for <trial> selection to do this:

<block myblock>
/ trials = [1-72=list.triallist]
</block>

<list triallist>
/ items = (trial.a, trial.b, trial.c, trial.d)
/ itemprobabilities = (0.166, 0.333, 0.333, 0.166)
/ poolsize = 72
/ maxrunsize = 1
</list>

<trial a>
/ validresponse = (0)
/ trialduration = 100
</trial>

<trial b>
/ validresponse = (0)
/ trialduration = 100
</trial>

<trial c>
/ validresponse = (0)
/ trialduration = 100
</trial>

<trial d>
/ validresponse = (0)
/ trialduration = 100
</trial>

Edited 9 Years Ago by Dave
writekristin
writekristin
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 17, Visits: 62
thanks!  this does seem to work, although we did end up having some repeats at the end (e.g. trial.c, trial.c, trial.c), i suppose because it ran out of options in the end which can't be helped.

can you explain to me what it would mean to select with vs. without replacement in this case?  initially i thought selecting without replacement would mean it would select each of trial a, b, c, d, before reselecting them again, but this doesn't seem to be the case (and wouldn't really make sense for us anyway, since we have more b&c than a&d).
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: 100K
> this does seem to work, although we did end up having some repeats at the end (e.g. trial.c, trial.c, trial.c), i suppose because it > ran out of options in the end which can't be helped.

That's exactly right. You'll also find this detailed in the documentation:

"Random selection is done on the fly, so if multiple selection constraints such as not or replace are in place, it may not be possible to satisfy them all on a give trial, especially if there are only a few remaining items in the selection pool. In that case, the list will suspend one of the constraints and try again. If it still can not satisfy the remaining constraints, it suspends another and tries again, and so forth. By default, the maxrunsize constraint is suspended first, then replace, and finally the not constraints. If a procedure requires that the constraints always be satisfied, pregenerate a set of selection sequences that satisfy the constraints and then randomly select one of the pregenerated sequences to use for a given session."

> can you explain to me what it would mean to select with vs. without replacement in this case?

The <list> creates a pool of 72 items to sample from (/poolsize). The pool is populated with items according to the given proportions / probabilities (/itemprobabilities).

The pool is sampled from according to the specified mode in /selectionmode and /replace. Sampling without replacement ensures that you end up with exactly 12 elements of type A, 24 of type B, 24 of type C, and 12 of type D. Sampling with replacement does not give you that guarantee. Think of it as drawing from a deck of cards with 12 red cards, 24 green cards, 24 blue cards, and 12 yellow cards, and drawing cards from the deck either with or without putting the drawn card back into the deck.

Edited 9 Years Ago by Dave
writekristin
writekristin
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 17, Visits: 62
ok, got it, thank you!  i tend to get confused about whether with/without replacement refers to (if i have a <list> of trials) the type of <trial> (i.e. must use each type of trial a, b, c, d, before being able to use them again if taking without replacement) vs. selecting the underlying stimuli without replacement.  with the <list>, it seems like </maxrunsize> refers to the former.

so i have another question now!  it turns out i need to give different feedback based on a second binomial variable within the trial types.  so now i have:
<trial a_1> = 6
<trial a_2> = 6
<trial b_1> = 12
<trial b_2> = 12
<trial c_1> = 12
<trial c_2> = 12
<trial d_1> = 6
<trial d_2> = 6

once again, i do not want the same type of trial a, b, c, d, run consecutively. i can make a similar list like before, but then there is the possibility i will get trial.a_1, trial.a_2 consecutively, when i really don't want any trial of type a consecutively:
<list triallist>
/ items = (trial.a_1, trial.a_2, trial.b_1, trial.b_2, trial.c_1, trial.c_2, trial.d_1, trial.d_2)
/ itemprobabilities = (0.083, 0.083, 0.166, 0.166, 0.166, 0.166, 0.083, 0.083)
/ poolsize = 72
/ maxrunsize = 1
</list> 

i tried making lists that group trial.a_1, trial.a_2 together first, then doing a triallist of lists, but this did not seem to work.

i hope this makes sense!  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: 100K
You can in fact make a list of lists and use that for trial selection as before. Simple example below:

<block myblock>
/ trials = [1-8 = list.masterlist]
</block>

<list masterlist>
/ items = (list.a.nextvalue, list.b.nextvalue)
/ poolsize = 8
/ maxrunsize = 1
</list>

<list a>
/ items = (trial.a1, trial.a2)
/poolsize = 4
</list>

<list b>
/ items = (trial.b1, trial.b2)
/ poolsize = 4
</list>

<trial a1>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<trial a2>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<trial b1>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<trial b2>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%script.currenttrial%>")
</text>

You may also want to consider whether you really need two separate <trial> elements (a1, a2) per "type" (here: a). In most cases, it should be possible to realize the different feedback conditions with only one <trial> element per type (e.g. change the feedback at runtime as needed via conditional logic).

Edited 9 Years Ago by Dave
writekristin
writekristin
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 17, Visits: 62
thank you!  i was missing the "nextvalue."

yes, i was considering that also regarding using conditional logic.  trial's a_1 and a_2 use different stimuli though, so i am wondering how to distinguish in the trial which stimuli it was using.

if i have picture.a_1 and picture.a_2, and have trial.a select noreplacenorepeat(picture.a_1, picture.a_2), is there a way to access which one it used?

alternatively, i was thinking of combining them in picture.a, and using the currentitem property, which would work in this case because we have named the pictures accordingly to 1 vs 2.

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: 100K
I would do the latter which boils down to something like this (works the same with <picture> elements):

<values>
/ itemnumber = 1
</values>

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

<trial mytrial>
/ ontrialbegin = [values.itemnumber = list.itemnumbers.nextvalue]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("A", "B")
/ select = values.itemnumber
</text>

<list itemnumbers>
/ items = (1,1,2,2)
/ maxrunsize = 1
</list>


writekristin
writekristin
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 17, Visits: 62
Regarding the list of lists, I actually can't seem to get that to work.

<list a>
/ items = (trial.a_1, trial.a_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 12
/ selectionmode = random
/ replace = false
</list>

<list b>
/ items = (trial.b_1, trial.b_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 24
/ selectionmode = random
/ replace = false
</list>

<list c>
/ items = (trial.c_1, trial.c_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 24
/ selectionmode = random
/ replace = false
</list>

<list d>
/ items = (trial.d_1, trial.d_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 12
/ selectionmode = random
/ replace = false
</list>

<list trial_selector>
/ items = (list.a.nextvalue, list.b.nextvalue, list.c.nextvalue, list.d.nextvalue)
/ poolsize = 72
/ itemprobabilities = (0.166, 0.333, 0.333, 0.166)
/ maxrunsize =  1
</list>

<block array_experimental>
/ trials = [1-72=list.trial_selector]
</block>

For one, the probabilities seem to be off.  I have one situation where I have 11 trial.c_1 and 13 trial.c_2, when I expected 12 of each.  Also I am still getting consecutive trial.c_1, trial.c_2, when I was hoping to not get any consecutive trials of "type" c, which was why I was attempting a list of lists in the first place.  Thoughts?

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: 100K
The better approach in this particular scenario is to work with dummy <trial> elements (or re-think whether you really need two separate <trial>s per type as already discussed):

<list a>
/ items = (trial.a_1, trial.a_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 12
/ selectionmode = random
/ replace = false
</list>

<list b>
/ items = (trial.b_1, trial.b_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 24
/ selectionmode = random
/ replace = false
</list>

<list c>
/ items = (trial.c_1, trial.c_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 24
/ selectionmode = random
/ replace = false
</list>

<list d>
/ items = (trial.d_1, trial.d_2)
/ itemprobabilities = (0.5, 0.5)
/ poolsize = 12
/ selectionmode = random
/ replace = false
</list>

<list trial_selector>
/ items = (trial.a, trial.b, trial.c, trial.d)
/ poolsize = 72
/ itemprobabilities = (0.166, 0.333, 0.333, 0.166)
/ maxrunsize =  1
</list>

<block array_experimental>
/ trials = [1-72=list.trial_selector]
</block>

<trial a>
/ branch = [list.a.nextvalue]
/ recorddata = false
/ trialduration = 0
</trial>
<trial b>
/ branch = [list.b.nextvalue]
/ recorddata = false
/ trialduration = 0
</trial>
<trial c>
/ branch = [list.c.nextvalue]
/ recorddata = false
/ trialduration = 0
</trial>
<trial d>
/ branch = [list.d.nextvalue]
/ recorddata = false
/ trialduration = 0
</trial>


<trial a_1>
/ trialduration = 10
</trial>
<trial a_2>
/ trialduration = 10
</trial>
<trial b_1>
/ trialduration = 10
</trial>
<trial b_2>
/ trialduration = 10
</trial>
<trial c_1>
/ trialduration = 10
</trial>
<trial c_2>
/ trialduration = 10
</trial>
<trial d_1>
/ trialduration = 10
</trial>
<trial d_2>
/ trialduration = 10
</trial>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search