Random selection without replacement


Author
Message
Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Hi,


I have four picture elements that randomly select an item from an item element. However, I noticed that sometimes an item is selected more than once, even though I used the "noreplace" attribute. How can I randomly select without replacement? 

This is the relevant part of the code:

<item recallcues>
</item>

<trial fillrecallcues>
/ontrialbegin = [item.recallcues.item=item.poweritems1.1;
                 item.recallcues.item=item.indexitems2.1;
                 item.recallcues.item=item.fingeritems3.1;
                 item.recallcues.item=item.parallelitems4.1]
/ trialduration = 0
</trial>

<picture recallcue1>
/items = recallcues
/select = noreplace
/size = (20%,20%)
/ position = (10,10)
</picture>

<picture recallcue2>
/items = recallcues
/select = noreplace
/size = (20%,20%)
/ position = (30,10)
</picture>

<picture recallcue3>
/items = recallcues
/select = noreplace
/size = (20%,20%)
/ position = (50,10)
</picture>

<picture recallcue4>
/items = recallcues
/select = noreplace
/size = (20%,20%)
/ position = (70,10)
</picture>

Thanks,

Diane

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: 108K
See e.g. https://www.millisecond.com/forums/FindPost13609.aspx.

What you need to realize is that having several stimulus elements (<text>, <picture>) reference the same <item> element

<picture recallcue1>
/items = recallcues
/select = noreplace
/size = (20%,20%)
/ position = (10,10)
</picture>

<picture recallcue2>
/items = recallcues
/select = noreplace
/size = (20%,20%)
/ position = (30,10)
</picture>
...

does *not* establish a single selection pool for all those stimulus elements. They are independent and each one will sample from *all* the items given in the <item> element without replacement. I.e.

<text text1>
/ items = myitems
/ select = noreplace
...
</text>

<text text2>
/ items = myitems
/ select = noreplace
...
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

is equivalent to stating

<text text1>
/ items = ("A", "B", "C", "D")
/ select = noreplace
...
</text>

<text text2>
/ items = ("A", "B", "C", "D")
/ select = noreplace
...
</text>

Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Hi Dave

Thanks. That link doesnt seem to work, but perhaps my question can be solved in a different way.

The reason I have made 4 recallcue picture elements is that I want four pictures at four different locations on the screen, and which picture goes where should be random. Is there a way to do that with one picture element?


Thanks

Diane

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: 108K

And, yes, of course that's possible:

<trial mytrial>
/ stimulusframes = [1=t1,t2,t3,t4]
/ validresponse = (57)
</trial>

<text t1>
/ items = myitems
/ position = (20%, 50%)
/ select = list.mylist.nextvalue
</text>

<text t2>
/ items = myitems
/ position = (40%, 50%)
/ select = list.mylist.nextvalue
</text>

<text t3>
/ items = myitems
/ position = (60%, 50%)
/ select = list.mylist.nextvalue
</text>

<text t4>
/ items = myitems
/ position = (80%, 50%)
/ select = list.mylist.nextvalue
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

<list mylist>
/ items = (1,2,3,4)
/ selectionrate = always
</list>

(works the same for <picture> elements).

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search