Macronutrient and Taste Preference Ranking Task


Author
Message
justin.geng@postgrad.otago...
justin.geng@postgrad.otago.ac.nz
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 4, Visits: 21
Hi,
I'm new to inquisit and was wondering if the system would support the Macronutrient and Taste preference test. 
The test comprises of 4 sections.
1) Practice ranking task -participants have to rank 4 images of food based on the order they would like to eat them
2) Liking- participants rank their liking of 32 food images (same images used later in the test)
3) Ranking macronutrient pictures- participants are presented with four images - one from each macronutrient category (fats, carbs, protein and low calorie) and are asked to rank them in the order they would like to eat them in.
32 food images are presented in a total of 16 combinations so each image is presented twice. The order of the presented images is randomised and balanced across trials.
4) Ranking tastes - participants presented with 4 images - a sweet and a savoury picture from the and fats categories and asked to rank them in the order they would like to eat them.
16 images are presented in a total of 12 combinations and each image is presented twice. The order is also randomised and balanced across trials.

Any help on which codes to start with or where to take it would be much appreciated

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: 81K
Hi,
I'm new to inquisit and was wondering if the system would support the Macronutrient and Taste preference test. 
The test comprises of 4 sections.
1) Practice ranking task -participants have to rank 4 images of food based on the order they would like to eat them
2) Liking- participants rank their liking of 32 food images (same images used later in the test)
3) Ranking macronutrient pictures- participants are presented with four images - one from each macronutrient category (fats, carbs, protein and low calorie) and are asked to rank them in the order they would like to eat them in.
32 food images are presented in a total of 16 combinations so each image is presented twice. The order of the presented images is randomised and balanced across trials.
4) Ranking tastes - participants presented with 4 images - a sweet and a savoury picture from the and fats categories and asked to rank them in the order they would like to eat them.
16 images are presented in a total of 12 combinations and each image is presented twice. The order is also randomised and balanced across trials.

Any help on which codes to start with or where to take it would be much appreciated

Thanks

All of this should be doable. As for how to start:
- The language overview: https://www.millisecond.com/support/docs/v6/html/introduction.htm
- The tutorials: https://www.millisecond.com/support/docs/v6/html/tutorials/tutorials.htm
- The how-to section:https://www.millisecond.com/support/docs/v6/html/howto/howto.htm

Then pick a few tasks from the library that interest you and worh through those scripts: https://www.millisecond.com/download/library/
Look up things you are unfamiliar with in the language reference: https://www.millisecond.com/support/docs/v6/html/language/languagereference.htm


justin.geng@postgrad.otago...
justin.geng@postgrad.otago.ac.nz
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 4, Visits: 21
Thank you Dave,

Do you know if this task fits any of the tests within the Millisecond test library or would it be something I would have to make from scratch
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: 81K
Thank you Dave,

Do you know if this task fits any of the tests within the Millisecond test library or would it be something I would have to make from scratch

Some scripts will have similar some similar components, so you can find inspiration, but the best approach is doing it from scratch in my opinion. I can't point to anything specific, because, for one, your descriptions is fairly general and vague.
- "Ranking" images can be done in a dozen different ways. In "32 food images are presented in a total of 16 combinations so each image is presented twice" it is unclear  what the 16 combinations are or how they're supposed to be assembled, etc.

justin.geng@postgrad.otago...
justin.geng@postgrad.otago.ac.nz
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 4, Visits: 21
Dave - 1/19/2022
Thank you Dave,

Do you know if this task fits any of the tests within the Millisecond test library or would it be something I would have to make from scratch

Some scripts will have similar some similar components, so you can find inspiration, but the best approach is doing it from scratch in my opinion. I can't point to anything specific, because, for one, your descriptions is fairly general and vague.
- "Ranking" images can be done in a dozen different ways. In "32 food images are presented in a total of 16 combinations so each image is presented twice" it is unclear  what the 16 combinations are or how they're supposed to be assembled, etc.

I was just trying to keep it simple but below is the full explanation. Firstly for the ranking I would like the participants to rank according to the what they most desired to eat at that moment. So for them to first click on the food they desired to eat the most, then click on the second most desired food, then click on the third, then the fourth most desired food. This is the same for all ranking tasks.
1) Practice ranking -Uses a total of 16 food images (different images from later ranking task). Participants are presented four images at a time and are asked to rate them according to what they desired most at that moment above. 4 sets of 4 pictures presented. 
2)Liking - participants shown each of the 32 food pictures (4 sweet and 4 savoury from fat and carbohydrate groups, 8 savoury from protein and 8 low calories) one at a time asked 'how much do you like this product" rated on a 100 VAS scale.
3a) Ranking -macronutrients -Participants presented with four pictures at a time, one from each of the macronutrient groups and asked to rank according to the what they most desired to eat at that moment. Here 16 combinations/trials of these 32 food pictures were shown, with each picture shown twice. The order was randomised and balanced- each macronutrient appeared 4 times on each of the 4 available positions and the same picture never appeared on the same position twice.
3b) Ranking -taste0 participants shown a total of 16 images ( the 4 sweet and 4 savoury for both fat and carbohydrate groups), for each 4 picture trial/combination there was one savoury carb, one sweet carb, one savoury fat, and one sweet fat. There was a total of 12 combinations/trials were completed in which they ranked the 4 food images based on what they desired the most at that time. Here each picture was also shown twice. This was also randomised and balanced- both tastes appearred 6 times in each of the four available positions. All pictures were presented twice in 2 different positions.

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: 81K
Dave - 1/19/2022
Thank you Dave,

Do you know if this task fits any of the tests within the Millisecond test library or would it be something I would have to make from scratch

Some scripts will have similar some similar components, so you can find inspiration, but the best approach is doing it from scratch in my opinion. I can't point to anything specific, because, for one, your descriptions is fairly general and vague.
- "Ranking" images can be done in a dozen different ways. In "32 food images are presented in a total of 16 combinations so each image is presented twice" it is unclear  what the 16 combinations are or how they're supposed to be assembled, etc.

I was just trying to keep it simple but below is the full explanation. Firstly for the ranking I would like the participants to rank according to the what they most desired to eat at that moment. So for them to first click on the food they desired to eat the most, then click on the second most desired food, then click on the third, then the fourth most desired food. This is the same for all ranking tasks.
1) Practice ranking -Uses a total of 16 food images (different images from later ranking task). Participants are presented four images at a time and are asked to rate them according to what they desired most at that moment above. 4 sets of 4 pictures presented. 
2)Liking - participants shown each of the 32 food pictures (4 sweet and 4 savoury from fat and carbohydrate groups, 8 savoury from protein and 8 low calories) one at a time asked 'how much do you like this product" rated on a 100 VAS scale.
3a) Ranking -macronutrients -Participants presented with four pictures at a time, one from each of the macronutrient groups and asked to rank according to the what they most desired to eat at that moment. Here 16 combinations/trials of these 32 food pictures were shown, with each picture shown twice. The order was randomised and balanced- each macronutrient appeared 4 times on each of the 4 available positions and the same picture never appeared on the same position twice.
3b) Ranking -taste0 participants shown a total of 16 images ( the 4 sweet and 4 savoury for both fat and carbohydrate groups), for each 4 picture trial/combination there was one savoury carb, one sweet carb, one savoury fat, and one sweet fat. There was a total of 12 combinations/trials were completed in which they ranked the 4 food images based on what they desired the most at that time. Here each picture was also shown twice. This was also randomised and balanced- both tastes appearred 6 times in each of the four available positions. All pictures were presented twice in 2 different positions.

Okay, and what are your concrete questions?
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: 81K
Dave - 1/20/2022
Dave - 1/19/2022
Thank you Dave,

Do you know if this task fits any of the tests within the Millisecond test library or would it be something I would have to make from scratch

Some scripts will have similar some similar components, so you can find inspiration, but the best approach is doing it from scratch in my opinion. I can't point to anything specific, because, for one, your descriptions is fairly general and vague.
- "Ranking" images can be done in a dozen different ways. In "32 food images are presented in a total of 16 combinations so each image is presented twice" it is unclear  what the 16 combinations are or how they're supposed to be assembled, etc.

I was just trying to keep it simple but below is the full explanation. Firstly for the ranking I would like the participants to rank according to the what they most desired to eat at that moment. So for them to first click on the food they desired to eat the most, then click on the second most desired food, then click on the third, then the fourth most desired food. This is the same for all ranking tasks.
1) Practice ranking -Uses a total of 16 food images (different images from later ranking task). Participants are presented four images at a time and are asked to rate them according to what they desired most at that moment above. 4 sets of 4 pictures presented. 
2)Liking - participants shown each of the 32 food pictures (4 sweet and 4 savoury from fat and carbohydrate groups, 8 savoury from protein and 8 low calories) one at a time asked 'how much do you like this product" rated on a 100 VAS scale.
3a) Ranking -macronutrients -Participants presented with four pictures at a time, one from each of the macronutrient groups and asked to rank according to the what they most desired to eat at that moment. Here 16 combinations/trials of these 32 food pictures were shown, with each picture shown twice. The order was randomised and balanced- each macronutrient appeared 4 times on each of the 4 available positions and the same picture never appeared on the same position twice.
3b) Ranking -taste0 participants shown a total of 16 images ( the 4 sweet and 4 savoury for both fat and carbohydrate groups), for each 4 picture trial/combination there was one savoury carb, one sweet carb, one savoury fat, and one sweet fat. There was a total of 12 combinations/trials were completed in which they ranked the 4 food images based on what they desired the most at that time. Here each picture was also shown twice. This was also randomised and balanced- both tastes appearred 6 times in each of the four available positions. All pictures were presented twice in 2 different positions.

Okay, and what are your concrete questions?

As a starting point, here's rough draft for what you labelled part 3a -- the macronutrient ranking. On-screen posititions are assigned such that across the 16 ranking rounds, each category will appear in each of the 4 on-screen positions a total of 4 times.
Sets of 4 items (one from each category) are randomly generated at runtime, such that you'll see each product once in the first 8 ranking rounds (1 to 8), and another time in the  last 8 ranking rounds (9 to 16). This does not satisfy "the same picture never appeared on the same position twice." That can only work if specific 4-item sets are assembled and assigned specific positions beforehand. Since there is no information on how exactly the original authors did this and which criteria they used to assemble the sets, I cannot really help with that -- too much guesswork and speculation.

<defaults>
/ canvasaspectratio = (4,3)
/ screencolor = black
/ txcolor = white
/ txbgcolor = black
/ fontstyle = ("Arial", 2.5%)
/ inputdevice = mouse
</defaults>

<item hi_carb>
// sweet
/ 1 = "hc01.png"
/ 2 = "hc02.png"
/ 3 = "hc03.png"
/ 4 = "hc04.png"
// savoury
/ 5 = "hc05.png"
/ 6 = "hc06.png"
/ 7 = "hc07.png"
/ 8 = "hc08.png"
</item>

<item hi_fat>
// sweet
/ 1 = "hf01.png"
/ 2 = "hf02.png"
/ 3 = "hf03.png"
/ 4 = "hf04.png"
// savoury
/ 5 = "hf05.png"
/ 6 = "hf06.png"
/ 7 = "hf07.png"
/ 8 = "hf08.png"
</item>

<item hi_protein>
// sweet
/ 1 = "hp01.png"
/ 2 = "hp02.png"
/ 3 = "hp03.png"
/ 4 = "hp04.png"
// savoury
/ 5 = "hp05.png"
/ 6 = "hp06.png"
/ 7 = "hp07.png"
/ 8 = "hp08.png"
</item>

<item lo_energy>
// sweet
/ 1 = "le01.png"
/ 2 = "le02.png"
/ 3 = "le03.png"
/ 4 = "le04.png"
// savoury
/ 5 = "le05.png"
/ 6 = "le06.png"
/ 7 = "le07.png"
/ 8 = "le08.png"
</item>

<parameters>
// blank period duration at end of each ranking round / before start of next round
/ itiduration = 1000
// x & y coordinates for 1st screen quadrant (left/top)
/ pos_1x = 25%
/ pos_1y = 25%
// x & y coordinates for 2nd screen quadrant (right/top)
/ pos_2x = 75%
/ pos_2y = 25%
// x & y coordinates for 3rd screen quadrant (left/bottom)
/ pos_3x = 25%
/ pos_3y = 75%
// x & y coordinates for 4th screen quadrant (right/bottom)
/ pos_4x = 75%
/ pos_4y = 75%
</parameters>

on-screen positions:
+-------------------+
| | |
| 1 | 2 |
| | |
+-------------------+
| | |
| 3 | 4 |
| | |
+-------------------+

// category on-screen positions are arranged by latin squares
// such that across 16 ranking rounds each category will be
// displayed 4 times in each position
<list hc_pos>
/ items = (1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3)
/ selectionmode = random
</list>

<list hf_pos>
/ items = (2,3,4,1, 3,4,1,2, 4,1,2,3, 1,2,3,4)
/ selectionmode = list.hc_pos.currentindex
</list>

<list hp_pos>
/ items = (3,4,1,2, 4,1,2,3, 1,2,3,4, 2,3,4,1)
/ selectionmode = list.hc_pos.currentindex
</list>

<list le_pos>
/ items = (4,1,2,3, 1,2,3,4, 2,3,4,1, 3,4,1,2)
/ selectionmode = list.hc_pos.currentindex
</list>

<list x>
/ items = (parameters.pos_1x, parameters.pos_2x, parameters.pos_3x, parameters.pos_4x)
</list>

<list y>
/ items = (parameters.pos_1y, parameters.pos_2y, parameters.pos_3y, parameters.pos_4y)
</list>

<list responses>
</list>

// high carb
<list hc_itemnumbers>
/ items = (
    list.hc_sweet_itemnumbers.item(1), list.hc_sweet_itemnumbers.item(2), list.hc_sweet_itemnumbers.item(3), list.hc_sweet_itemnumbers.item(4),
    list.hc_savory_itemnumbers.item(1), list.hc_savory_itemnumbers.item(2), list.hc_savory_itemnumbers.item(3), list.hc_savory_itemnumbers.item(4))
</list>

<list hc_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list hc_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// high fat
<list hf_itemnumbers>
/ items = (
    list.hf_sweet_itemnumbers.item(1), list.hf_sweet_itemnumbers.item(2), list.hf_sweet_itemnumbers.item(3), list.hf_sweet_itemnumbers.item(4),
    list.hf_savory_itemnumbers.item(1), list.hf_savory_itemnumbers.item(2), list.hf_savory_itemnumbers.item(3), list.hf_savory_itemnumbers.item(4))
</list>

<list hf_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list hf_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// high protein
<list hp_itemnumbers>
/ items = (
    list.hp_sweet_itemnumbers.item(1), list.hp_sweet_itemnumbers.item(2), list.hp_sweet_itemnumbers.item(3), list.hp_sweet_itemnumbers.item(4),
    list.hp_savory_itemnumbers.item(1), list.hp_savory_itemnumbers.item(2), list.hp_savory_itemnumbers.item(3), list.hp_savory_itemnumbers.item(4))
</list>

<list hp_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list hp_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// low energy
<list le_itemnumbers>
/ items = (
    list.le_sweet_itemnumbers.item(1), list.le_sweet_itemnumbers.item(2), list.le_sweet_itemnumbers.item(3), list.le_sweet_itemnumbers.item(4),
    list.le_savory_itemnumbers.item(1), list.le_savory_itemnumbers.item(2), list.le_savory_itemnumbers.item(3), list.le_savory_itemnumbers.item(4))
</list>

<list le_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list le_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// macronutritient ranking block
<block macro>
/ onblockbegin = [
    values.round = 0;
]
/ trials = [1-16 = macro_rank1]
</block>

// assign rank 1
<trial macro_rank1>
/ ontrialbegin = [
    // set up the ensuing ranking round
    // clear responses from previous round
    list.responses.reset();
    // increase round counter by one
    values.round += 1;
    // show all four options
    picture.hc.skip = false;
    picture.hf.skip = false;
    picture.hp.skip = false;
    picture.le.skip = false;
    
    // reset ranks for this round
    values.hc_rank = 0;
    values.hf_rank = 0;
    values.hp_rank = 0;
    values.le_rank = 0;
    
    // select item numbers for the four categories to use in this ranking round
    values.hc_itemnumber = list.hc_itemnumbers.nextvalue;
    values.hf_itemnumber = list.hf_itemnumbers.nextvalue;
    values.hp_itemnumber = list.hp_itemnumbers.nextvalue;
    values.le_itemnumber = list.le_itemnumbers.nextvalue;
    
    // select on-screen positions for the four categories to use in this round
    values.hc_pos = list.hc_pos.nextvalue;
    values.hf_pos = list.hf_pos.nextvalue;
    values.hp_pos = list.hp_pos.nextvalue;
    values.le_pos = list.le_pos.nextvalue;
    
    values.hc_x = list.x.item(values.hc_pos);
    values.hc_y = list.y.item(values.hc_pos);
    values.hf_x = list.x.item(values.hf_pos);
    values.hf_y = list.y.item(values.hf_pos);
    values.hp_x = list.x.item(values.hp_pos);
    values.hp_y = list.y.item(values.hp_pos);
    values.le_x = list.x.item(values.le_pos);
    values.le_y = list.y.item(values.le_pos);
]

/ ontrialend = [
    // track response given in order to exclude it from possible responses in next rank assignment trial
    list.responses.appenditem(trial.macro_rank1.response);
    if (trial.macro_rank1.response == "hc") {
        // store which category was given rank 1 in this round
        values.hc_rank = 1;
    // increase rank count of selected category
        values.hc_macro_rank1count += 1;
    // remove selected category from screen for remaining round
        picture.hc.skip = true;
    } else if (trial.macro_rank1.response == "hf") {
        values.hf_rank = 1;
        values.hf_macro_rank1count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank1.response == "hp") {
        values.hp_rank = 1;
        values.hp_macro_rank1count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank1.response == "le") {
        values.le_rank = 1;
        values.le_macro_rank1count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ branch = [
    return trial.macro_rank2;
]
/ recorddata = false
</trial>

// assign rank 2
<trial macro_rank2>

/ ontrialend = [
    list.responses.appenditem(trial.macro_rank2.response);
    if (trial.macro_rank2.response == "hc") {
        values.hc_rank = 2;
        values.hc_macro_rank2count += 1;
        picture.hc.skip = true;
    } else if (trial.macro_rank2.response == "hf") {
        values.hf_rank = 2;
        values.hf_macro_rank2count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank2.response == "hp") {
        values.hp_rank = 2;
        values.hp_macro_rank2count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank2.response == "le") {
        values.le_rank = 2;
        values.le_macro_rank2count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ isvalidresponse = [
    // response only valid if not already given in previous ranking trial
    list.responses.indexof(trial.macro_rank2.response) == -1;
]
/ branch = [
    return trial.macro_rank3;
]
/ recorddata = false
</trial>

// assign rank 3
<trial macro_rank3>

/ ontrialend = [
    list.responses.appenditem(trial.macro_rank3.response);
    if (trial.macro_rank3.response == "hc") {
        values.hc_rank = 3;
        values.hc_macro_rank3count += 1;
        picture.hc.skip = true;
    } else if (trial.macro_rank3.response == "hf") {
        values.hf_rank = 3;
        values.hf_macro_rank3count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank3.response == "hp") {
        values.hp_rank = 3;
        values.hp_macro_rank3count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank3.response == "le") {
        values.le_rank = 3;
        values.le_macro_rank3count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ isvalidresponse = [
    list.responses.indexof(trial.macro_rank3.response) == -1;
]
/ branch = [
    return trial.macro_rank4;
]
/ recorddata = false
</trial>

// assign rank 4
<trial macro_rank4>

/ ontrialend = [
    list.responses.appenditem(trial.macro_rank4.response);
    if (trial.macro_rank4.response == "hc") {
        values.hc_rank = 4;
        values.hc_macro_rank4count += 1;
        picture.hc.skip = true;
    } else if (trial.macro_rank4.response == "hf") {
        values.hf_rank = 4;
        values.hf_macro_rank4count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank4.response == "hp") {
        values.hp_rank = 4;
        values.hp_macro_rank4count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank4.response == "le") {
        values.le_rank = 4;
        values.le_macro_rank4count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ isvalidresponse = [
    list.responses.indexof(trial.macro_rank4.response) == -1;
]
/ branch = [
    return trial.iti;
]
/ recorddata = false
</trial>

// log round data, clear screen at end of round, brief pause before next round
<trial iti>
/ stimulusframes = [1=clearscreen]
/ trialduration = parameters.itiduration
/ validresponse = (0)
/ recorddata = true
</trial>


<text question>
/ items = ("What do you most desire to eat at this moment?")
/ position = (50%, 5%)
/ erase = false
</text>

<picture hc>
/ items = hi_carb
/ select = values.hc_itemnumber
/ hposition = values.hc_x
/ vposition = values.hc_y
/ erase = false
/ size = (30%, 35%)
</picture>

<picture hf>
/ items = hi_fat
/ select = values.hf_itemnumber
/ hposition = values.hf_x
/ vposition = values.hf_y
/ erase = false
/ size = (30%, 35%)
</picture>

<picture hp>
/ items = hi_protein
/ select = values.hp_itemnumber
/ hposition = values.hp_x
/ vposition = values.hp_y
/ erase = false
/ size = (30%, 35%)
</picture>

<picture le>
/ items = lo_energy
/ select = values.le_itemnumber
/ hposition = values.le_x
/ vposition = values.le_y
/ erase = false
/ size = (30%, 35%)
</picture>

<values>
// variables to store item number presented and screen position assigned for each category in a given ranking round
/ hc_itemnumber = 1
/ hc_pos = 0
/ hc_x = 0%
/ hc_y = 0%

/ hf_itemnumber = 1
/ hf_pos = 0
/ hf_x = 0%
/ hf_y = 0%

/ hp_itemnumber = 1
/ hp_pos = 0
/ hp_x = 0%
/ hp_y = 0%

/ le_itemnumber = 1
/ le_pos = 0
/ le_x = 0%
/ le_y = 0%
</values>

<values>
/ round = 0 // round counter

/ hc_rank = 0 // rank assigned to high carb category in current round
/ hf_rank = 0 // rank assigned to high fat category in current round
/ hp_rank = 0 // rank assigned to high protein category in current round
/ le_rank = 0 // rank assigned to low energy category in current round

/ hc_macro_rank1count = 0 // number of times the high carb category was ranked 1
/ hc_macro_rank2count = 0 // number of times the high carb category was ranked 2
/ hc_macro_rank3count = 0 // number of times the high carb category was ranked 3
/ hc_macro_rank4count = 0 // number of times the high carb category was ranked 4

// same for high fat category
/ hf_macro_rank1count = 0
/ hf_macro_rank2count = 0
/ hf_macro_rank3count = 0
/ hf_macro_rank4count = 0

// same for high protein category
/ hp_macro_rank1count = 0
/ hp_macro_rank2count = 0
/ hp_macro_rank3count = 0
/ hp_macro_rank4count = 0

// same for low energy category
/ le_macro_rank1count = 0
/ le_macro_rank2count = 0
/ le_macro_rank3count = 0
/ le_macro_rank4count = 0
</values>

<expressions>
// "relative macronutrient preference scores" for each category
/ hc_macro_score = ((4*values.hc_macro_rank1count) + (3*values.hc_macro_rank2count) + (2*values.hc_macro_rank3count) + (1*values.hc_macro_rank4count))/16;
/ hp_macro_score = ((4*values.hp_macro_rank1count) + (3*values.hp_macro_rank2count) + (2*values.hp_macro_rank3count) + (1*values.hp_macro_rank4count))/16;
/ hf_macro_score = ((4*values.hf_macro_rank1count) + (3*values.hf_macro_rank2count) + (2*values.hf_macro_rank3count) + (1*values.hf_macro_rank4count))/16;
/ le_macro_score = ((4*values.le_macro_rank1count) + (3*values.le_macro_rank2count) + (2*values.le_macro_rank3count) + (1*values.le_macro_rank4count))/16;
</expressions>

<data>
/ columns = (inquisit.version date time subject group session
    values.round values.hc_itemnumber values.hf_itemnumber values.hp_itemnumber values.le_itemnumber
    values.hc_pos values.hf_pos values.hp_pos values.le_pos
    values.hc_rank values.hf_rank values.hp_rank values.le_rank
    values.hc_macro_rank1count values.hc_macro_rank2count values.hc_macro_rank3count values.hc_macro_rank4count
    values.hf_macro_rank1count values.hf_macro_rank2count values.hf_macro_rank3count values.hf_macro_rank4count
    values.hp_macro_rank1count values.hp_macro_rank2count values.hp_macro_rank3count values.hp_macro_rank4count
    values.le_macro_rank1count values.le_macro_rank2count values.le_macro_rank3count values.le_macro_rank4count
    expressions.hc_macro_score expressions.hf_macro_score expressions.hp_macro_score expressions.le_macro_score
    )
/ separatefiles = true
</data>


The practice ranking (part 1) and taste-ranking (part 3b) components' set up would obviously be substantially similar, so you should be able to work those out after spending some quality time with the code. For part 2, "liking" each of the 32 products on a 100-point VAS scale, you will want to look into using <slidertrial> elements: https://www.millisecond.com/support/docs/v6/html/language/elements/slidertrial.htm

Placeholder images for use with the code above are in the attached ZIP archive.

Attachments
mtprt_macro.zip (36 views, 34.00 KB)
justin.geng@postgrad.otago...
justin.geng@postgrad.otago.ac.nz
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 4, Visits: 21
Dave - 1/20/2022
Dave - 1/20/2022
Dave - 1/19/2022
Thank you Dave,

Do you know if this task fits any of the tests within the Millisecond test library or would it be something I would have to make from scratch

Some scripts will have similar some similar components, so you can find inspiration, but the best approach is doing it from scratch in my opinion. I can't point to anything specific, because, for one, your descriptions is fairly general and vague.
- "Ranking" images can be done in a dozen different ways. In "32 food images are presented in a total of 16 combinations so each image is presented twice" it is unclear  what the 16 combinations are or how they're supposed to be assembled, etc.

I was just trying to keep it simple but below is the full explanation. Firstly for the ranking I would like the participants to rank according to the what they most desired to eat at that moment. So for them to first click on the food they desired to eat the most, then click on the second most desired food, then click on the third, then the fourth most desired food. This is the same for all ranking tasks.
1) Practice ranking -Uses a total of 16 food images (different images from later ranking task). Participants are presented four images at a time and are asked to rate them according to what they desired most at that moment above. 4 sets of 4 pictures presented. 
2)Liking - participants shown each of the 32 food pictures (4 sweet and 4 savoury from fat and carbohydrate groups, 8 savoury from protein and 8 low calories) one at a time asked 'how much do you like this product" rated on a 100 VAS scale.
3a) Ranking -macronutrients -Participants presented with four pictures at a time, one from each of the macronutrient groups and asked to rank according to the what they most desired to eat at that moment. Here 16 combinations/trials of these 32 food pictures were shown, with each picture shown twice. The order was randomised and balanced- each macronutrient appeared 4 times on each of the 4 available positions and the same picture never appeared on the same position twice.
3b) Ranking -taste0 participants shown a total of 16 images ( the 4 sweet and 4 savoury for both fat and carbohydrate groups), for each 4 picture trial/combination there was one savoury carb, one sweet carb, one savoury fat, and one sweet fat. There was a total of 12 combinations/trials were completed in which they ranked the 4 food images based on what they desired the most at that time. Here each picture was also shown twice. This was also randomised and balanced- both tastes appearred 6 times in each of the four available positions. All pictures were presented twice in 2 different positions.

Okay, and what are your concrete questions?

As a starting point, here's rough draft for what you labelled part 3a -- the macronutrient ranking. On-screen posititions are assigned such that across the 16 ranking rounds, each category will appear in each of the 4 on-screen positions a total of 4 times.
Sets of 4 items (one from each category) are randomly generated at runtime, such that you'll see each product once in the first 8 ranking rounds (1 to 8), and another time in the  last 8 ranking rounds (9 to 16). This does not satisfy "the same picture never appeared on the same position twice." That can only work if specific 4-item sets are assembled and assigned specific positions beforehand. Since there is no information on how exactly the original authors did this and which criteria they used to assemble the sets, I cannot really help with that -- too much guesswork and speculation.

<defaults>
/ canvasaspectratio = (4,3)
/ screencolor = black
/ txcolor = white
/ txbgcolor = black
/ fontstyle = ("Arial", 2.5%)
/ inputdevice = mouse
</defaults>

<item hi_carb>
// sweet
/ 1 = "hc01.png"
/ 2 = "hc02.png"
/ 3 = "hc03.png"
/ 4 = "hc04.png"
// savoury
/ 5 = "hc05.png"
/ 6 = "hc06.png"
/ 7 = "hc07.png"
/ 8 = "hc08.png"
</item>

<item hi_fat>
// sweet
/ 1 = "hf01.png"
/ 2 = "hf02.png"
/ 3 = "hf03.png"
/ 4 = "hf04.png"
// savoury
/ 5 = "hf05.png"
/ 6 = "hf06.png"
/ 7 = "hf07.png"
/ 8 = "hf08.png"
</item>

<item hi_protein>
// sweet
/ 1 = "hp01.png"
/ 2 = "hp02.png"
/ 3 = "hp03.png"
/ 4 = "hp04.png"
// savoury
/ 5 = "hp05.png"
/ 6 = "hp06.png"
/ 7 = "hp07.png"
/ 8 = "hp08.png"
</item>

<item lo_energy>
// sweet
/ 1 = "le01.png"
/ 2 = "le02.png"
/ 3 = "le03.png"
/ 4 = "le04.png"
// savoury
/ 5 = "le05.png"
/ 6 = "le06.png"
/ 7 = "le07.png"
/ 8 = "le08.png"
</item>

<parameters>
// blank period duration at end of each ranking round / before start of next round
/ itiduration = 1000
// x & y coordinates for 1st screen quadrant (left/top)
/ pos_1x = 25%
/ pos_1y = 25%
// x & y coordinates for 2nd screen quadrant (right/top)
/ pos_2x = 75%
/ pos_2y = 25%
// x & y coordinates for 3rd screen quadrant (left/bottom)
/ pos_3x = 25%
/ pos_3y = 75%
// x & y coordinates for 4th screen quadrant (right/bottom)
/ pos_4x = 75%
/ pos_4y = 75%
</parameters>

on-screen positions:
+-------------------+
| | |
| 1 | 2 |
| | |
+-------------------+
| | |
| 3 | 4 |
| | |
+-------------------+

// category on-screen positions are arranged by latin squares
// such that across 16 ranking rounds each category will be
// displayed 4 times in each position
<list hc_pos>
/ items = (1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3)
/ selectionmode = random
</list>

<list hf_pos>
/ items = (2,3,4,1, 3,4,1,2, 4,1,2,3, 1,2,3,4)
/ selectionmode = list.hc_pos.currentindex
</list>

<list hp_pos>
/ items = (3,4,1,2, 4,1,2,3, 1,2,3,4, 2,3,4,1)
/ selectionmode = list.hc_pos.currentindex
</list>

<list le_pos>
/ items = (4,1,2,3, 1,2,3,4, 2,3,4,1, 3,4,1,2)
/ selectionmode = list.hc_pos.currentindex
</list>

<list x>
/ items = (parameters.pos_1x, parameters.pos_2x, parameters.pos_3x, parameters.pos_4x)
</list>

<list y>
/ items = (parameters.pos_1y, parameters.pos_2y, parameters.pos_3y, parameters.pos_4y)
</list>

<list responses>
</list>

// high carb
<list hc_itemnumbers>
/ items = (
    list.hc_sweet_itemnumbers.item(1), list.hc_sweet_itemnumbers.item(2), list.hc_sweet_itemnumbers.item(3), list.hc_sweet_itemnumbers.item(4),
    list.hc_savory_itemnumbers.item(1), list.hc_savory_itemnumbers.item(2), list.hc_savory_itemnumbers.item(3), list.hc_savory_itemnumbers.item(4))
</list>

<list hc_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list hc_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// high fat
<list hf_itemnumbers>
/ items = (
    list.hf_sweet_itemnumbers.item(1), list.hf_sweet_itemnumbers.item(2), list.hf_sweet_itemnumbers.item(3), list.hf_sweet_itemnumbers.item(4),
    list.hf_savory_itemnumbers.item(1), list.hf_savory_itemnumbers.item(2), list.hf_savory_itemnumbers.item(3), list.hf_savory_itemnumbers.item(4))
</list>

<list hf_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list hf_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// high protein
<list hp_itemnumbers>
/ items = (
    list.hp_sweet_itemnumbers.item(1), list.hp_sweet_itemnumbers.item(2), list.hp_sweet_itemnumbers.item(3), list.hp_sweet_itemnumbers.item(4),
    list.hp_savory_itemnumbers.item(1), list.hp_savory_itemnumbers.item(2), list.hp_savory_itemnumbers.item(3), list.hp_savory_itemnumbers.item(4))
</list>

<list hp_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list hp_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// low energy
<list le_itemnumbers>
/ items = (
    list.le_sweet_itemnumbers.item(1), list.le_sweet_itemnumbers.item(2), list.le_sweet_itemnumbers.item(3), list.le_sweet_itemnumbers.item(4),
    list.le_savory_itemnumbers.item(1), list.le_savory_itemnumbers.item(2), list.le_savory_itemnumbers.item(3), list.le_savory_itemnumbers.item(4))
</list>

<list le_sweet_itemnumbers>
/ items = (1,2,3,4)
</list>

<list le_savory_itemnumbers>
/ items = (5,6,7,8)
</list>

// macronutritient ranking block
<block macro>
/ onblockbegin = [
    values.round = 0;
]
/ trials = [1-16 = macro_rank1]
</block>

// assign rank 1
<trial macro_rank1>
/ ontrialbegin = [
    // set up the ensuing ranking round
    // clear responses from previous round
    list.responses.reset();
    // increase round counter by one
    values.round += 1;
    // show all four options
    picture.hc.skip = false;
    picture.hf.skip = false;
    picture.hp.skip = false;
    picture.le.skip = false;
    
    // reset ranks for this round
    values.hc_rank = 0;
    values.hf_rank = 0;
    values.hp_rank = 0;
    values.le_rank = 0;
    
    // select item numbers for the four categories to use in this ranking round
    values.hc_itemnumber = list.hc_itemnumbers.nextvalue;
    values.hf_itemnumber = list.hf_itemnumbers.nextvalue;
    values.hp_itemnumber = list.hp_itemnumbers.nextvalue;
    values.le_itemnumber = list.le_itemnumbers.nextvalue;
    
    // select on-screen positions for the four categories to use in this round
    values.hc_pos = list.hc_pos.nextvalue;
    values.hf_pos = list.hf_pos.nextvalue;
    values.hp_pos = list.hp_pos.nextvalue;
    values.le_pos = list.le_pos.nextvalue;
    
    values.hc_x = list.x.item(values.hc_pos);
    values.hc_y = list.y.item(values.hc_pos);
    values.hf_x = list.x.item(values.hf_pos);
    values.hf_y = list.y.item(values.hf_pos);
    values.hp_x = list.x.item(values.hp_pos);
    values.hp_y = list.y.item(values.hp_pos);
    values.le_x = list.x.item(values.le_pos);
    values.le_y = list.y.item(values.le_pos);
]

/ ontrialend = [
    // track response given in order to exclude it from possible responses in next rank assignment trial
    list.responses.appenditem(trial.macro_rank1.response);
    if (trial.macro_rank1.response == "hc") {
        // store which category was given rank 1 in this round
        values.hc_rank = 1;
    // increase rank count of selected category
        values.hc_macro_rank1count += 1;
    // remove selected category from screen for remaining round
        picture.hc.skip = true;
    } else if (trial.macro_rank1.response == "hf") {
        values.hf_rank = 1;
        values.hf_macro_rank1count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank1.response == "hp") {
        values.hp_rank = 1;
        values.hp_macro_rank1count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank1.response == "le") {
        values.le_rank = 1;
        values.le_macro_rank1count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ branch = [
    return trial.macro_rank2;
]
/ recorddata = false
</trial>

// assign rank 2
<trial macro_rank2>

/ ontrialend = [
    list.responses.appenditem(trial.macro_rank2.response);
    if (trial.macro_rank2.response == "hc") {
        values.hc_rank = 2;
        values.hc_macro_rank2count += 1;
        picture.hc.skip = true;
    } else if (trial.macro_rank2.response == "hf") {
        values.hf_rank = 2;
        values.hf_macro_rank2count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank2.response == "hp") {
        values.hp_rank = 2;
        values.hp_macro_rank2count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank2.response == "le") {
        values.le_rank = 2;
        values.le_macro_rank2count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ isvalidresponse = [
    // response only valid if not already given in previous ranking trial
    list.responses.indexof(trial.macro_rank2.response) == -1;
]
/ branch = [
    return trial.macro_rank3;
]
/ recorddata = false
</trial>

// assign rank 3
<trial macro_rank3>

/ ontrialend = [
    list.responses.appenditem(trial.macro_rank3.response);
    if (trial.macro_rank3.response == "hc") {
        values.hc_rank = 3;
        values.hc_macro_rank3count += 1;
        picture.hc.skip = true;
    } else if (trial.macro_rank3.response == "hf") {
        values.hf_rank = 3;
        values.hf_macro_rank3count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank3.response == "hp") {
        values.hp_rank = 3;
        values.hp_macro_rank3count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank3.response == "le") {
        values.le_rank = 3;
        values.le_macro_rank3count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ isvalidresponse = [
    list.responses.indexof(trial.macro_rank3.response) == -1;
]
/ branch = [
    return trial.macro_rank4;
]
/ recorddata = false
</trial>

// assign rank 4
<trial macro_rank4>

/ ontrialend = [
    list.responses.appenditem(trial.macro_rank4.response);
    if (trial.macro_rank4.response == "hc") {
        values.hc_rank = 4;
        values.hc_macro_rank4count += 1;
        picture.hc.skip = true;
    } else if (trial.macro_rank4.response == "hf") {
        values.hf_rank = 4;
        values.hf_macro_rank4count += 1;
        picture.hf.skip = true;
    } else if (trial.macro_rank4.response == "hp") {
        values.hp_rank = 4;
        values.hp_macro_rank4count += 1;
        picture.hp.skip = true;
    } else if (trial.macro_rank4.response == "le") {
        values.le_rank = 4;
        values.le_macro_rank4count += 1;
        picture.le.skip = true;
    };
]

/ stimulusframes = [1=clearscreen, hc, hf, hp, le, question]
/ validresponse = (hc, hf, hp, le)
/ isvalidresponse = [
    list.responses.indexof(trial.macro_rank4.response) == -1;
]
/ branch = [
    return trial.iti;
]
/ recorddata = false
</trial>

// log round data, clear screen at end of round, brief pause before next round
<trial iti>
/ stimulusframes = [1=clearscreen]
/ trialduration = parameters.itiduration
/ validresponse = (0)
/ recorddata = true
</trial>


<text question>
/ items = ("What do you most desire to eat at this moment?")
/ position = (50%, 5%)
/ erase = false
</text>

<picture hc>
/ items = hi_carb
/ select = values.hc_itemnumber
/ hposition = values.hc_x
/ vposition = values.hc_y
/ erase = false
/ size = (30%, 35%)
</picture>

<picture hf>
/ items = hi_fat
/ select = values.hf_itemnumber
/ hposition = values.hf_x
/ vposition = values.hf_y
/ erase = false
/ size = (30%, 35%)
</picture>

<picture hp>
/ items = hi_protein
/ select = values.hp_itemnumber
/ hposition = values.hp_x
/ vposition = values.hp_y
/ erase = false
/ size = (30%, 35%)
</picture>

<picture le>
/ items = lo_energy
/ select = values.le_itemnumber
/ hposition = values.le_x
/ vposition = values.le_y
/ erase = false
/ size = (30%, 35%)
</picture>

<values>
// variables to store item number presented and screen position assigned for each category in a given ranking round
/ hc_itemnumber = 1
/ hc_pos = 0
/ hc_x = 0%
/ hc_y = 0%

/ hf_itemnumber = 1
/ hf_pos = 0
/ hf_x = 0%
/ hf_y = 0%

/ hp_itemnumber = 1
/ hp_pos = 0
/ hp_x = 0%
/ hp_y = 0%

/ le_itemnumber = 1
/ le_pos = 0
/ le_x = 0%
/ le_y = 0%
</values>

<values>
/ round = 0 // round counter

/ hc_rank = 0 // rank assigned to high carb category in current round
/ hf_rank = 0 // rank assigned to high fat category in current round
/ hp_rank = 0 // rank assigned to high protein category in current round
/ le_rank = 0 // rank assigned to low energy category in current round

/ hc_macro_rank1count = 0 // number of times the high carb category was ranked 1
/ hc_macro_rank2count = 0 // number of times the high carb category was ranked 2
/ hc_macro_rank3count = 0 // number of times the high carb category was ranked 3
/ hc_macro_rank4count = 0 // number of times the high carb category was ranked 4

// same for high fat category
/ hf_macro_rank1count = 0
/ hf_macro_rank2count = 0
/ hf_macro_rank3count = 0
/ hf_macro_rank4count = 0

// same for high protein category
/ hp_macro_rank1count = 0
/ hp_macro_rank2count = 0
/ hp_macro_rank3count = 0
/ hp_macro_rank4count = 0

// same for low energy category
/ le_macro_rank1count = 0
/ le_macro_rank2count = 0
/ le_macro_rank3count = 0
/ le_macro_rank4count = 0
</values>

<expressions>
// "relative macronutrient preference scores" for each category
/ hc_macro_score = ((4*values.hc_macro_rank1count) + (3*values.hc_macro_rank2count) + (2*values.hc_macro_rank3count) + (1*values.hc_macro_rank4count))/16;
/ hp_macro_score = ((4*values.hp_macro_rank1count) + (3*values.hp_macro_rank2count) + (2*values.hp_macro_rank3count) + (1*values.hp_macro_rank4count))/16;
/ hf_macro_score = ((4*values.hf_macro_rank1count) + (3*values.hf_macro_rank2count) + (2*values.hf_macro_rank3count) + (1*values.hf_macro_rank4count))/16;
/ le_macro_score = ((4*values.le_macro_rank1count) + (3*values.le_macro_rank2count) + (2*values.le_macro_rank3count) + (1*values.le_macro_rank4count))/16;
</expressions>

<data>
/ columns = (inquisit.version date time subject group session
    values.round values.hc_itemnumber values.hf_itemnumber values.hp_itemnumber values.le_itemnumber
    values.hc_pos values.hf_pos values.hp_pos values.le_pos
    values.hc_rank values.hf_rank values.hp_rank values.le_rank
    values.hc_macro_rank1count values.hc_macro_rank2count values.hc_macro_rank3count values.hc_macro_rank4count
    values.hf_macro_rank1count values.hf_macro_rank2count values.hf_macro_rank3count values.hf_macro_rank4count
    values.hp_macro_rank1count values.hp_macro_rank2count values.hp_macro_rank3count values.hp_macro_rank4count
    values.le_macro_rank1count values.le_macro_rank2count values.le_macro_rank3count values.le_macro_rank4count
    expressions.hc_macro_score expressions.hf_macro_score expressions.hp_macro_score expressions.le_macro_score
    )
/ separatefiles = true
</data>


The practice ranking (part 1) and taste-ranking (part 3b) components' set up would obviously be substantially similar, so you should be able to work those out after spending some quality time with the code. For part 2, "liking" each of the 32 products on a 100-point VAS scale, you will want to look into using <slidertrial> elements: https://www.millisecond.com/support/docs/v6/html/language/elements/slidertrial.htm

Placeholder images for use with the code above are in the attached ZIP archive.

Great, thank you so much, I really appreciate your help.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search