randomly splitting item into two


Author
Message
anisa_khalfan
anisa_khalfan
Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)Associate Member (263 reputation)
Group: Forum Members
Posts: 25, Visits: 104
I have an item with 14 foods, and I want to randomly divide half into an item called natural_condition and the other half into an item called health_condition each time a participant runs the experiment. Is there a function that lets me do this? I have attached the item code below. 
Thanks in advance.

<item foodpic>
/1 = "Cheetos_4_25pc.jpg"
/2 = "Aero_2_.5bar.jpg"
/3 = "Twizzlers_3_4.jpg"
/4 = "TeddyGrahams_2_15pc.jpg"
/5 = "Snickers_1_0.5bar.jpeg"
/6 = "Skittles_4_0.25pack.jpg"
/7 = "ChipsAhoy_4_2cookies.jpg"
/8 = "RitzBits_4_15pieces.jpg"
/9 = "RufflesAllDressed_3_10chips.jpg"
/10= "Smartfood_3_32Chips.jpg"
/11 = "Spinach_2_.5c.jpg"
/12 = "Orange_2_0.5orange.jpg"
/13 = "GreenGrapes_3_12.jpg"
/14 = "BrusselsSprouts_3_0.5box.jpg"
</item>

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: 98K
anisa_khalfan - 6/16/2020
I have an item with 14 foods, and I want to randomly divide half into an item called natural_condition and the other half into an item called health_condition each time a participant runs the experiment. Is there a function that lets me do this? I have attached the item code below. 
Thanks in advance.

<item foodpic>
/1 = "Cheetos_4_25pc.jpg"
/2 = "Aero_2_.5bar.jpg"
/3 = "Twizzlers_3_4.jpg"
/4 = "TeddyGrahams_2_15pc.jpg"
/5 = "Snickers_1_0.5bar.jpeg"
/6 = "Skittles_4_0.25pack.jpg"
/7 = "ChipsAhoy_4_2cookies.jpg"
/8 = "RitzBits_4_15pieces.jpg"
/9 = "RufflesAllDressed_3_10chips.jpg"
/10= "Smartfood_3_32Chips.jpg"
/11 = "Spinach_2_.5c.jpg"
/12 = "Orange_2_0.5orange.jpg"
/13 = "GreenGrapes_3_12.jpg"
/14 = "BrusselsSprouts_3_0.5box.jpg"
</item>

You do something like this:

<list allitemnumbers>
/ poolsize = 14
/ selectionrate = always
</list>

// item numbers we'll use in the health condition
<list healthitemnumbers>
</list>
// item numbers we'll use in the natural condition
<list naturalitemnumbers>
</list>

// put 7 random item numbers out of 14 into the health list
// put the remaining 7 item numbers out of 14 into the natural list
<expt>
/ onexptbegin = [
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.healthitemnumbers.appenditem(list.allitemnumbers.nextindex);
    
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
    list.naturalitemnumbers.appenditem(list.allitemnumbers.nextindex);
]
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1-14 = noreplace(healthtrial, naturaltrial)]
</block>

<trial healthtrial>
/ stimulusframes = [1=healthpic]
/ validresponse = (57)
</trial>

<trial naturaltrial>
/ stimulusframes = [1=naturalpic]
/ validresponse = (57)
</trial>

<picture healthpic>
/ items = foodpic
/ select = list.healthitemnumbers.nextvalue
</picture>

<picture naturalpic>
/ items = foodpic
/ select = list.naturalitemnumbers.nextvalue
</picture>

<item foodpic>
/1 = "Cheetos_4_25pc.jpg"
/2 = "Aero_2_.5bar.jpg"
/3 = "Twizzlers_3_4.jpg"
/4 = "TeddyGrahams_2_15pc.jpg"
/5 = "Snickers_1_0.5bar.jpeg"
/6 = "Skittles_4_0.25pack.jpg"
/7 = "ChipsAhoy_4_2cookies.jpg"
/8 = "RitzBits_4_15pieces.jpg"
/9 = "RufflesAllDressed_3_10chips.jpg"
/10= "Smartfood_3_32Chips.jpg"
/11 = "Spinach_2_.5c.jpg"
/12 = "Orange_2_0.5orange.jpg"
/13 = "GreenGrapes_3_12.jpg"
/14 = "BrusselsSprouts_3_0.5box.jpg"
</item>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search