Splitting items into different categories


Author
Message
DK
DK
DK
posted 6 Years Ago HOT
Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)
Group: Forum Members
Posts: 7, Visits: 97
Let's say I have 3 different item categories (cars, colors, prizes), each category consists of 6 different items.

<item colors>
/1 = "red"
/2 = "blue"
/3 = "white"
/4 = "yellow"
/5 = "black"
/6 = "green"
</item>
<item cars>
/1 = "Ford"
/2 = "Audi"
/3 = "BMW"
/4 = "Mercedes"
/5 = "Toyota"
/6 = "Tesla"
</item>
<item prizes>
/1 = "10000"
/2 = "15000"
/3 = "20000"
/4 = "30000"
/5 = "40000"
/6 = "50000"
</item>

Now, I want to create 3 new sets of items (S1,S2,S3) in a specific way: S1 contains 1 random item of each item category, S2 contains 1 random item of each category that is not already in S1, S3 contains all other items. This should leave me with sets of items that look like this:
<item S1>
/1 = "blue"
/2 = "Tesla"
/3 = "50000"
</item>

<item S2>
/1 = "yellow"
/2 = "Audi"
/3 = "40000"
</item>

<item S3>
/1 = "red"
/2 = "white"
/3 = "black"
/4 = "green"
/5 = "Ford"
/6 = "BMW"
/7 = "Mercedes"
/8 = "Toyota"
/9 = "10000"
/10 = "15000"
/11 = "20000"
/12 = "30000"
</item>

This "random selection" is only done once at the beginning of the experiment and should be replicable given the same subjectid. (Ideally, all the items should be equally often in S1 and S2 between participants.)

Does anyone have an idea how to do this?

Best,
DK

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
DK - Monday, September 24, 2018
Let's say I have 3 different item categories (cars, colors, prizes), each category consists of 6 different items.

<item colors>
/1 = "red"
/2 = "blue"
/3 = "white"
/4 = "yellow"
/5 = "black"
/6 = "green"
</item>
<item cars>
/1 = "Ford"
/2 = "Audi"
/3 = "BMW"
/4 = "Mercedes"
/5 = "Toyota"
/6 = "Tesla"
</item>
<item prizes>
/1 = "10000"
/2 = "15000"
/3 = "20000"
/4 = "30000"
/5 = "40000"
/6 = "50000"
</item>

Now, I want to create 3 new sets of items (S1,S2,S3) in a specific way: S1 contains 1 random item of each item category, S2 contains 1 random item of each category that is not already in S1, S3 contains all other items. This should leave me with sets of items that look like this:
<item S1>
/1 = "blue"
/2 = "Tesla"
/3 = "50000"
</item>

<item S2>
/1 = "yellow"
/2 = "Audi"
/3 = "40000"
</item>

<item S3>
/1 = "red"
/2 = "white"
/3 = "black"
/4 = "green"
/5 = "Ford"
/6 = "BMW"
/7 = "Mercedes"
/8 = "Toyota"
/9 = "10000"
/10 = "15000"
/11 = "20000"
/12 = "30000"
</item>

This "random selection" is only done once at the beginning of the experiment and should be replicable given the same subjectid. (Ideally, all the items should be equally often in S1 and S2 between participants.)

Does anyone have an idea how to do this?

Best,
DK

If the selection is supposed to be replicable given the same subject id, then the selection is not random, but deterministic. You'd have to come up with a mapping function of sorts. Further, if you want to ensure that items are distributed equally between S1 and S2 across participants, then I see no other way that to define (possibly a lot of) conditions hard-coding specific item combinations and then assigning participants to those conditions based on subject id.

DK
DK
Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)
Group: Forum Members
Posts: 7, Visits: 97
Dave - Monday, September 24, 2018

If the selection is supposed to be replicable given the same subject id, then the selection is not random, but deterministic. You'd have to come up with a mapping function of sorts. Further, if you want to ensure that items are distributed equally between S1 and S2 across participants, then I see no other way that to define (possibly a lot of) conditions hard-coding specific item combinations and then assigning participants to those conditions based on subject id.

I don't know how Inquisit generates random numbers, I had something pseudo random in mind that is deterministic when you know the initial state (e.g. a seed based on the subject id.)

Let's say I code all 30 possible mapping functions for a single category (e.g. MappingFun1: item 1 -> S1, item 2 -> S2, item 3-6 -> S3; MappingFun2: item 1-> S1, item 3 -> S2, items 2,4,5,6 -> S3 and so on).
Would there be a pseudo random way (as described above) to pick 3 out of these 30 and apply them to the item categories individually? If I have to abandon the idea of pseudo randomness all together and hard-code that participant X will apply MappingFun27 to category 1 (colors), MappingFun13 to category 2 and so on... How would such a mapping function look like in Inquisit and how would it be applied?

Many thanks!
DK

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
DK - Monday, September 24, 2018
Dave - Monday, September 24, 2018

If the selection is supposed to be replicable given the same subject id, then the selection is not random, but deterministic. You'd have to come up with a mapping function of sorts. Further, if you want to ensure that items are distributed equally between S1 and S2 across participants, then I see no other way that to define (possibly a lot of) conditions hard-coding specific item combinations and then assigning participants to those conditions based on subject id.

I don't know how Inquisit generates random numbers, I had something pseudo random in mind that is deterministic when you know the initial state (e.g. a seed based on the subject id.)

Let's say I code all 30 possible mapping functions for a single category (e.g. MappingFun1: item 1 -> S1, item 2 -> S2, item 3-6 -> S3; MappingFun2: item 1-> S1, item 3 -> S2, items 2,4,5,6 -> S3 and so on).
Would there be a pseudo random way (as described above) to pick 3 out of these 30 and apply them to the item categories individually? If I have to abandon the idea of pseudo randomness all together and hard-code that participant X will apply MappingFun27 to category 1 (colors), MappingFun13 to category 2 and so on... How would such a mapping function look like in Inquisit and how would it be applied?

Many thanks!
DK

There is no way to explicitly specify the seed value for the internal random number generators Inquisit uses and tie different seeds to different subject ids or conditions, so that option is out. You'd have to roll your own mapping function(s). You can of course select X of those randomly putting the expressions in a <list> and then sampling three /onexptbegin. I cannot tell you how the mapping function would look like, you'd have to come up with some scheme that satisfies your needs, which include that items are distributed equally between S1 and S2 across participants. One useful technique to develop an idea that works is to not think about how the code might look like. Instead imagine that you're dealing with decks of cards (e.g. three decks -- cars, colors, prizes -- with six cards each). How would you go about distributing those cards in a way that meets your requirements? Once you can describe the steps you'd go through, those same steps can be translated into code quite easily.

Edited 6 Years Ago by Dave
DK
DK
Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)
Group: Forum Members
Posts: 7, Visits: 97
I opted for a unconventional solution and used another program that gives me the hard-coding as an output. However, I have issues programming the following pseudo-code:

if ( subjectid == 1 ) {
<item S1>
/1 = "yellow"
/2 = "Audi"
/3 = "40000"
</item>
} else if ( subjectid == 2 ) {
<item S1>
/1 = "red"
/2 = "Mercedes"
/3 = "30000"
</item>
}

The solution is probably very simple but I just can't see it. (This expression has only to be evaluated once per participant.)

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
DK - Wednesday, September 26, 2018
I opted for a unconventional solution and used another program that gives me the hard-coding as an output. However, I have issues programming the following pseudo-code:

if ( subjectid == 1 ) {
<item S1>
/1 = "yellow"
/2 = "Audi"
/3 = "40000"
</item>
} else if ( subjectid == 2 ) {
<item S1>
/1 = "red"
/2 = "Mercedes"
/3 = "30000"
</item>
}

The solution is probably very simple but I just can't see it. (This expression has only to be evaluated once per participant.)

You can set up an expressions in the  <expressions> element and then execute it /onexptbegin. For your pseudocode example, it would look like this in Inquisit syntax:

<expressions>
/ set_s1 = if (script.subjectid == 1) {
item.s1.setitem("yellow", 1);
item.s1.setitem("Audi", 2);
item.s1.setitem("40000", 3);
} else if (script.subjectid == 2) {
item.s1.setitem("red", 1);
item.s1.setitem("Mercedes", 2);
item.s1.setitem("30000", 3);
};
</expressions>

<expt>
/ onexptbegin = [
expressions.set_s1;
]
/ blocks = [1=myblock]
</expt>

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

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

<text mytext>
/ items = s1
/ select = sequence
</text>

<item s1>
/ 1 = ""
/ 2 = ""
/ 3 = ""
</item>

DK
DK
Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)Respected Member (422 reputation)
Group: Forum Members
Posts: 7, Visits: 97
Thank you very much! That seems to work just fine!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search