Randomly assign items to trial type


Author
Message
gracethenoob
gracethenoob
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 11, Visits: 85
I am coding an experiment in which participants learn about two categories of objects then are given an old/new memory task. For the first part of the experiment, participants see half of the total pool of objects and learn that half of those (so a quarter of the total) belong to Category A and the other half (another quarter of the total) belong to Category B. For the second part of the experiment, participants see all of the previously seen objects again, interspersed with all of the remaining objects from the original pool of objects. (25% Category A, 25% Category B, 50% Remaining)

While it looks pretty straightforward to choose which objects are in Category A/B/remaining up front and just randomize their presentation, what I would like to do is randomly assign the objects from the pool of objects to the categories and then randomize the order of presentation. What is a good way to go about doing this?

Hypothetical code:

<item pool_of_objects>
/1 = truck
/2 = banana
/3 = sweater
/ 4= umbrella
</item>

*magical category assignment randomization such that I end up with ...*

<item pool_CategoryA>
/1 = banana
</item>

<item pool_CategoryB>
/1 = sweater
</item>

<item pool_Remaining>
/1 = truck
/2 = umbrella
</item>


<trial CategoryA>
/stimulustimes = [0 = CategoryA]
</trial>

<trial CategoryB>
/stimulustimes = [0 = CategoryB]
</trial>

<trial Category_Remain>
/stimulustimes = [0 = Remaining]
</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: 104K
Easiest to simply work with item numbers and distribute those randomly to a couple of lists:

<expt>
/ onexptbegin = [list.categoryaitems.appenditem(list.nitems.nextindex);
    list.categorybitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);]
/ blocks = [1,3=a_and_b; 2,4=remaining]
</expt>

<block a_and_b>
/ trials = [1-2=noreplace(categorya, categoryb)]
</block>

<block remaining>
/ trials = [1-2=category_remain]
</block>


<item pool_of_objects>
/1 = "truck"
/2 = "banana"
/3 = "sweater"
/4= "umbrella"
</item>

4 items to distribute randomly to a, b and remaining
<list nitems>
/ poolsize = 4
/ selectionmode = random
/ selectionrate = always
</list>

Fill lists empty lists with item numbers at runtime
<list categoryaitems>
</list>

<list categorybitems>
</list>

<list remainingitems>
</list>

<text categorya>
/ items = pool_of_objects
/ select = list.categoryaitems.nextvalue
</text>

<text categoryb>
/ items = pool_of_objects
/ select = list.categorybitems.nextvalue
</text>

<text remaining>
/ items = pool_of_objects
/ select = list.remainingitems.nextvalue
</text>


<trial CategoryA>
/stimulustimes = [0 = CategoryA]
/ validresponse = (57)
</trial>

<trial CategoryB>
/stimulustimes = [0 = CategoryB]
/ validresponse = (57)
</trial>

<trial Category_Remain>
/stimulustimes = [0 = Remaining]
/ validresponse = (57)
</trial>

gracethenoob
gracethenoob
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 11, Visits: 85
Thank you so much for your response! The randomization of stimuli into Categories A/B/Remaining is partially working the way I want it to now.
What's working: the script is randomly selecting different stimuli to be in each category
What's not working: When I tried to change the pool size (from 4 to 24), I was still stuck with a total effective pool size of 4. In other words, although the script is randomly selecting images from my 24-item pool, it only picks 4 of them (1 catA, 1 catB, 2 Remaining - which is the correct ratio) and just repeats them until I reach my specified number of trials rather than getting through all of them.

I get the feeling that I must be missing something somewhere but I'm not sure where. What might be going on here??

My current code is as follows:

<item pool_of_objects>
/1 = "eggplant.jpg"
/2 = "shorts.jpg"
/3 = "toydinosaur.jpg"
/4 = "swimgoggles.jpg"
/5 = "box01.jpg"
/6 = "bandaid01.jpg"
/7 = "nailclipper03b.jpg"
/8 = "hammer01.jpg"
/9 = "toothbrush03b.jpg"
/10 = "telephone01b.jpg"
/11 = "asparagus.jpg"
/12 = "beermug01a.jpg"
/13 = "cap01a.jpg"
/14 = "grater01a.jpg"
/15 = "coconut.jpg"
/16 = "honeydewmelon.jpg"
/17 = "keyboard02.jpg"
/18 = "comb02a.jpg"
/19 = "baseball01a.jpg"
/20 = "playingcard04.jpg"
/21 = "vase01.jpg"
/22 = "pill.jpg"
/23 = "nail.jpg"
/24 = "pencil01.jpg"
</item>

<list nitems>
/ poolsize = 24
/ selectionmode = random
/ selectionrate = always
</list>


Fill lists empty lists with item numbers at runtime

<list categoryaitems>
</list>

<list categorybitems>
</list>

<list remainingitems>
</list>


<picture categorya>
/ items = pool_of_objects
/size = (20%, 20%)
/vposition = (60%, 60%)
/ select = list.categoryaitems.nextvalue
</picture>

<picture categoryb>
/ items = pool_of_objects
/size = (20%, 20%)
/vposition = (60%, 60%)
/ select = list.categorybitems.nextvalue
</picture>

<picture remaining>
/ items = pool_of_objects
/size = (20%, 20%)
/vposition = (60%, 60%)
/ select = list.remainingitems.nextvalue
</picture>

##################################################

<trial CategoryA>
/stimulustimes = [0 = categorya]
/ validresponse = ("N", "O", "S")
</trial>

<trial CategoryB>
/stimulustimes = [0 = categoryb]
/ validresponse = ("N", "O", "S")
</trial>

<trial Category_Remain1>
/stimulustimes = [0 = remaining]
/ validresponse = ("N", "O", "S")
</trial>

 

##################################################

<block a_and_b>
/preinstructions = (blockAB)
/ trials = [1-12 = noreplacenorepeat(CategoryA, CategoryB)]
</block>

<block remaining>
/preinstructions = (blockRemain)
/ trials = [1-24 = noreplacenorepeat(CategoryA, CategoryB, Category_Remain)]
</block>


##################################################

<expt>
/ onexptbegin = [list.categoryaitems.appenditem(list.nitems.nextindex);
    list.categorybitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);]
/ blocks = [1 = a_and_b; 2 = remaining]
</expt>



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: 104K
> In other words, although the script is randomly selecting images from my 24-item pool, it only picks 4 of them

The assigment happens here, /onexptbegin. As you can see, *one* item is added to list.categoryaitems, *one* item to list.categorybitems, and *two* to list.remainingitems. I.e., you are *only using 4 items*.

<expt>
/ onexptbegin = [list.categoryaitems.appenditem(list.nitems.nextindex);
    list.categorybitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);]
/ blocks = [1 = a_and_b; 2 = remaining]
</expt>

If you want to add more items to a respective list, add statements accordingly. To assign *two* items to list.categoryaitems, *two* to list.categorybitems, and *four* to list.remainingitems you do

<expt>
/ onexptbegin = [list.categoryaitems.appenditem(list.nitems.nextindex);
    list.categoryaitems.appenditem(list.nitems.nextindex);
    list.categorybitems.appenditem(list.nitems.nextindex);
    list.categorybitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);
    list.remainingitems.appenditem(list.nitems.nextindex);]
/ blocks = [1 = a_and_b; 2 = remaining]
</expt>

Extend accordingly for whatever item counts per list you want / need.

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: 104K
Also, assuming you want to end up with 6 items in categoryA, 6 items in categoryB and 12 items for categoryRemaining AND you want your 2nd <block> to display all of those once, the /trials attribute ought to read:

<block remaining>
/preinstructions = (blockRemain)
/ trials = [1-24 = noreplacenorepeat(CategoryA, CategoryB, Category_Remain, Category_Remain)]
</block>

You want twice as many Category_Remain trials (12) as CategoryA (6) or CategoryB (6) trials. The proportions you enter matter.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search