Question about random selecting stimuli


Author
Message
Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



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
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Oh yes I repeated it 17 times actually because the first 3 were not the stimuli...
And so what I should use is this?

<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false

But something was wrong...
Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Oh yes I repeated it 17 times actually because the first 3 were not the stimuli...
And so what I should use is this?

<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false

But something was wrong...

An update:

So I ended up using:
<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency, stimulusitem, stimulusitem, stimulusitem,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false
</data>

with 3 "stimulusitem" first so that data also record the round info that we need. It seems that all the stimuli info are now recorded. However, a weird thing is that after the n stimuli info for a certain trial, there are some "WML1.jpg" to fill up the rest of the columns. How to ensure that data only record what are actually shown? 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: 98K
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Oh yes I repeated it 17 times actually because the first 3 were not the stimuli...
And so what I should use is this?

<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false

But something was wrong...

Yes, that should work. Note, though, that for the dynamically inserted stimuli, i.e. those not present in every trial, currentitem will have a value even if the stimulus was not shown in the respective trial. I.e. suppose text.slot_10 is displayed in trial #1 and the item is "x", but text.slot_10 is NOT displayed in trial #2. Then text.slot_10.currentitem in the data file row for trial #2 will still display the value "x" (because that item was selected in the previous trial and is still the text element's current item).

Instead of logging the currentitem properties, you could also simply log the various values you already have in your script that record item numbers, i.e. values.slot_01_item and so forth. And if you want to avoide the currentitem issue outlined above, simply set those values all to "" at the very beginning of each round /ontrialbegin before you do anything else in <trial example>.

Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Oh yes I repeated it 17 times actually because the first 3 were not the stimuli...
And so what I should use is this?

<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false

But something was wrong...

Yes, that should work. Note, though, that for the dynamically inserted stimuli, i.e. those not present in every trial, currentitem will have a value even if the stimulus was not shown in the respective trial. I.e. suppose text.slot_10 is displayed in trial #1 and the item is "x", but text.slot_10 is NOT displayed in trial #2. Then text.slot_10.currentitem in the data file row for trial #2 will still display the value "x" (because that item was selected in the previous trial and is still the text element's current item).

Instead of logging the currentitem properties, you could also simply log the various values you already have in your script that record item numbers, i.e. values.slot_01_item and so forth. And if you want to avoide the currentitem issue outlined above, simply set those values all to "" at the very beginning of each round /ontrialbegin before you do anything else in <trial example>.

Great! It works well now! Thank you so much!
Another small issue we have had and failed to solve (if there is a way to solve it, that would be great; if not, we will figure out a way in R when we clean the data) is:
trialnum tracks every stimulus. so even if we set those trials to not record data, trialnum still increases a lot.
For example, for the first trial (where n = 10), the relevant trialnum can be 1, 12, ... (because there are 10 trials for stimuli)
Is there a way to make the 12 be 2?
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
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Oh yes I repeated it 17 times actually because the first 3 were not the stimuli...
And so what I should use is this?

<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false

But something was wrong...

Yes, that should work. Note, though, that for the dynamically inserted stimuli, i.e. those not present in every trial, currentitem will have a value even if the stimulus was not shown in the respective trial. I.e. suppose text.slot_10 is displayed in trial #1 and the item is "x", but text.slot_10 is NOT displayed in trial #2. Then text.slot_10.currentitem in the data file row for trial #2 will still display the value "x" (because that item was selected in the previous trial and is still the text element's current item).

Instead of logging the currentitem properties, you could also simply log the various values you already have in your script that record item numbers, i.e. values.slot_01_item and so forth. And if you want to avoide the currentitem issue outlined above, simply set those values all to "" at the very beginning of each round /ontrialbegin before you do anything else in <trial example>.

Great! It works well now! Thank you so much!
Another small issue we have had and failed to solve (if there is a way to solve it, that would be great; if not, we will figure out a way in R when we clean the data) is:
trialnum tracks every stimulus. so even if we set those trials to not record data, trialnum still increases a lot.
For example, for the first trial (where n = 10), the relevant trialnum can be 1, 12, ... (because there are 10 trials for stimuli)
Is there a way to make the 12 be 2?

The only way is to forego the built-in trialnum and instead create a <values> entry, increase it by 1 at the start of every round and log that value instead of trialnum.

Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, May 14, 2018
Kate61 - Monday, May 14, 2018
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Monday, December 11, 2017
Dave - Monday, December 11, 2017
Kate61 - Sunday, December 10, 2017
Dave - Saturday, December 9, 2017
Kate61 - Saturday, December 9, 2017
Dave - Monday, December 4, 2017
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

Hi Dave, we've come up with a way to mathematically formalize the sampling process. Please take a look and see if it makes sense/is doable in Inquisit!

For each trial:
First, randomly select one item from a list of numbers:
N = (8, 9, 10, 11, 12, 13, …, 19, 20); [integers from 8-20]
Let’s say this time the number 14 is selected (this number is the total number of stimuli in this trial)

Second, randomly select one item from a list of categories:
Type = (WM, WF, BM, BF); These are the 4 types of stimuli.
Let’s say this time the type WF is selected.

Third, randomly select one item from a list of numbers [notice: the largest integer here is determined by the total number N]:
X1 = (1, 2, 3, …, 11), the largest number here should be N - 3 (there are 3 types left and each should at least has one stimuli in the display). Here N = 14. So X1 should be assigned a number from 1 to 11.
Let’s say this time the number 3 is selected.
This means there will be 3 stimuli in the WF category in the display for this trial. (so for this trial X1=3)

Fourth, randomly select one item from the reduced list of categories—
(Or put it another way, the selection for “Type” is random selection without replacement)
so randomly select one item from (WM, BM, BF)
Let’s say this time the type WM is selected.

Fifth, randomly select one item from a list of numbers:
X2 = (1, 2, 3, …, 9), the largest number here should be N - X1 - 2 (there are 2 types left and each should at least has one stimuli in the display). Here N = 14, X1 = 3. So X2 should has be assigned a number from 1 to 9 (9=14-3-2).
Let’s say this time the number 5 is selected.
This means there will be 5 stimuli in the WF category in the display for this trial. (so for this trial X2=5)

Sixth, randomly select one item from the reduced list of categories—
so this time randomly select one item from (BM, BF)
Let’s say this time the type BM is selected.

Seventh, randomly select one item from a list of numbers:
X3 = (1, 2, 3, 4, 5), the largest number here should be N - X1 - X2 - 1 (there is 1 type left and it should at least has one stimuli in the display). Here N = 14, X1 = 3, X2 =5. So X3 should has be assigned a number from 1 to 5 (5=14-3-5-1).
Let’s say this time the number 2 is selected.
This means there will be 2 stimuli in the BM category in the display for this trial. (so for this trial X3=2)
And this also means there will be 4 stimuli in BF (4=14-3-5-2).

The above procedure determines the number of stimuli for each of the 4 types on one display screen (we have one display screen for one trial; for the next trial, all these selection process repeats again). We will also have the random location list to assign locations to them for each trial.

We'll need these information in our analyses later: total number of stimuli, and the number of stimuli for each category (for each trial)

Does the description make sense to you? Is there a way in Inquisit to do this? Thank you very much for your help!




The sampling process you described can be implemented like so:

<list n>
/ items = (8,9,10,11,12,13,14,15,16,17,18,19,20)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0
</values>


<trial mytrial>
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
</trial>

<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>

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

If you put that together with what we've covered previously in the thread, you should be good to go.

Hope this helps!


Thanks for the reply!
But I guess I didn't understand it...I tried to put the codes together but I felt there was something missing (e.g., I found I couldn't add "slot" and "x/y" position information correctly; so I couldn't link the sampling information to the actually stimuli display). And when I finally run the new codes, there was only a sentence you specified in the <text> ("WM: xx; WF:xx...") on the display screen. What should I do to have display screens containing those stimuli (not a sentence saying the number of the stimuli)?

I guess the codes are used to assign numbers to types of stimuli so that the actual stimuli will show on the screen right? How to make stimuli appear and only record the "numbers" info in the data file?
Thank you!

The "missing" part is this: After you've determined the "numbers" for the categories (WM, WF, ...) per your new sampling process, you need to fill an empty list with WM_N item numbers from the WM item numbers <list>, WF_N item numbers from the WF item numbers list, and so forth. You then sample from that list as needed.

Thank you!
But sorry I feel that I'm not very familiar with using "list"...I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?

Here are the previous 4 lists of 4 types of stimuli (as an example):
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always

Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)

<list WM_N>
/ items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
/ replace = false
/ selectionrate = always



> I guess I need to add 4 lists that each selects a certain number (as pre-decided in the codes) of stimuli?
Yes, you need those lists.

> Now I need to have some lists that select from those 4 lists separately with a goal of randomly selecting a pre-decided number of stimuli.
> Does it look something like this? (e.g., for WM: the pre-decided number of stimuli is values.wm_n)
>
> <list WM_N>
> / items = (values.wm_n). # this part seems unfamiliar (and not correct) to me...
> / replace = false
> / selectionrate = always
> </list>

No, you'd have a <list> that is entirely empty at first. After you've chosen wm_n, wf_n, etc. in the 1st step, you then run wm_n number of trials that each sample an item number from <list WM_itemnumbers> and add that to the empty list (per the appenditem() function). You do the same for wf_n bm_n and bf_n. That's the 2nd step. In the 3rd step, you then simply use the now-filled with item numbers in the desired proportions <list> as discussed previously.

Is that clearer?

Yeah this is clearer...I feel that I have a general (but still a bit vague) idea of what needs to be done.

But I still have a few questions:
When you referred to entirely empty lists, did you mean them?
<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max

Should I add something to them? What should I write to make it run wm_n number of trials that each sample an item number from the <list_WM_itemnumbers>? (I guess I still haven't figured out what codes do this part of "connection"--connecting the number we generated to "sampling this number of times")
Also, I'm not sure where I need to add new stuff...which lists and whether I also need to add something to "ontrialbegin"...

Is it possible if you gave me an example that I can learn from (just a basic structure of the core code) so that I can complete the codes based on it? Thank you!

You'll need to add one new, empty list. Here's an example putting the parts discussed throughout this thread together:

<list n>
/ items = (8,9,10,11,12,13,14)
/ replace = true
/ selectionrate = trial
</list>

<list x1>
/ poolsize = values.x1max
</list>

<list x2>
/ poolsize = values.x2max
</list>

<list x3>
/ poolsize = values.x3max
</list>

<list type>
/ items = ("wm","wf","bm","bf")
/ selectionrate = always
</list>

<values>
/ n = 0

/ x1max = 0
/ x2max = 0
/ x3max = 0

/ x1 = 0
/ x2 = 0
/ x3 = 0
/ x4 = 0

/ type = ""

/ wm_n = 0
/ wf_n = 0
/ bm_n = 0
/ bf_n = 0

/ fill_wm_count = 0
/ fill_wf_count = 0
/ fill_bm_count = 0
/ fill_bf_count = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.fill_wm_count = 0;
    values.fill_wf_count = 0;
    values.fill_bm_count = 0;
    values.fill_bf_count = 0;
    list.thisround.reset();
]
/ ontrialbegin = [
    values.n = list.n.nextvalue;
    values.x1max = values.n-3;
    list.x1.reset();
    values.x1 = list.x1.nextindex;
    values.x2max = values.n-values.x1-2;
    list.x2.reset();
    values.x2 = list.x2.nextindex;
    values.x3max = values.n-values.x1-values.x2-1;
    list.x3.reset();
    values.x3 = list.x3.nextindex;
    values.x4 = values.n-values.x1-values.x2-values.x3;
]

/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x1;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x1;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x1;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x1;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x2;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x2;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x2;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x2;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x3;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x3;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x3;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x3;
    };
]
/ ontrialbegin = [
    values.type = list.type.nextvalue;
    if (values.type == "wm") {
        values.wm_n = values.x4;
    }
    else if (values.type == "wf") {
        values.wf_n = values.x4;
    }
    else if (values.type == "bm") {
        values.bm_n = values.x4;
    }
    else if (values.type == "bf") {
        values.bf_n = values.x4;
    };
]
/ stimulusframes = [1=roundinfo]
/ validresponse = (57)
/ branch = [
    trial.fill_wm;
]
</trial>

<trial fill_wm>
/ ontrialbegin = [
    values.fill_wm_count += 1;
    list.thisround.appenditem(list.WM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wm_count < values.wm_n) trial.fill_wm else trial.fill_wf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_wf>
/ ontrialbegin = [
    values.fill_wf_count += 1;
    list.thisround.appenditem(list.WF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_wf_count < values.wf_n) trial.fill_wf else trial.fill_bm
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bm>
/ ontrialbegin = [
    values.fill_bm_count += 1;
    list.thisround.appenditem(list.BM_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bm_count < values.bm_n) trial.fill_bm else trial.fill_bf
]
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial fill_bf>
/ ontrialbegin = [
    values.fill_bf_count += 1;
    list.thisround.appenditem(list.BF_itemnumbers.nextvalue);
]
/ branch = [
    if (values.fill_bf_count < values.bf_n) trial.fill_bf else trial.example
]
/ validresponse = (0)
/ trialduration = 0
</trial>


<text roundinfo>
/ items = ("This round: n = <%values.n%>
x1 = <%values.x1%> | x2 = <%values.x2%> | x3 = <%values.x3%> | x4 = <%values.x4%>

resulting in

WM = <%values.wm_n%> | WF = <%values.wf_n%> | BM = <%values.bm_n%> | BF = <%values.bf_n%>")
/ size = (75%,50%)
</text>



// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

<list thisround>
/ selectionrate = always
</list>

<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.thisround.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.thisround.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.thisround.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.thisround.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.thisround.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.thisround.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.thisround.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.thisround.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.n >= 9) {
    values.slot_09_item = list.thisround.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 10) {
    values.slot_10_item = list.thisround.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 11) {
    values.slot_11_item = list.thisround.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 12) {
    values.slot_12_item = list.thisround.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 13) {
    values.slot_13_item = list.thisround.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.n >= 14) {
    values.slot_14_item = list.thisround.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

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



Hi Dave,

Thank you very much again for your help last time with the code! Everything works fine but there's one little issue that we've been trying to figure out how to solve. Do you know why in the data file the columns for "stimulusitem" only record item 1 to 8 but not the 9th to 14th (if there are any for that trial)?

So we have the code:

/ ontrialbegin = [
  if(values.n >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
  if(values.n >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
  if(values.n >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
  if(values.n >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
  if(values.n >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
  if(values.n >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]

/stimulustimes = [0=blank; 1=cross; 1250=blank;
  2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
  slot_08]

But it seems that item 9-14 are displayed but not recorded in the data file. Is there a way to solve this?
Thank you very much!



That is the expected behavior. What you need to do is explicitly specify a <data> element and explicitly log the respective stimulus elements' currentitem properties.

Yeah I did this...
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem, stimulusitem,
so the "stimulusitem" was repeated 14 times but this apparently is not the correct way to do it because the columns after the 8th stimulus were all empty...



No, stimulusitem won't capture the inserted stimuli. As I said, you need to log those _specific_ stimulus elements' currentitem properties. And 14 repetitions of stimulusitem wouldn't be enough anyway because the 1st three stimuli in your trial are

0=blank; 1=cross; 1250=blank;

So, what you need to do is:

<data>
/ columns = [..., text.slot_09.currentitem, text.slot_10.currentitem, ...]
...
</data>

or log same to values instead and log those.

Oh yes I repeated it 17 times actually because the first 3 were not the stimuli...
And so what I should use is this?

<data>
/ columns = [date, time, subject, computer.platform, blocknum, trialnum, blockcode, trialcode, response, latency,
    text.slot_01.currentitem, text.slot_02.currentitem, text.slot_03.currentitem, text.slot_04.currentitem, text.slot_05.currentitem, text.slot_06.currentitem, text.slot_07.currentitem,
text.slot_08.currentitem, text.slot_09.currentitem, text.slot_10.currentitem, text.slot_11.currentitem, text.slot_12.currentitem, text.slot_13.currentitem, text.slot_14.currentitem]
/ labels = true
/ separatefiles = false

But something was wrong...

Yes, that should work. Note, though, that for the dynamically inserted stimuli, i.e. those not present in every trial, currentitem will have a value even if the stimulus was not shown in the respective trial. I.e. suppose text.slot_10 is displayed in trial #1 and the item is "x", but text.slot_10 is NOT displayed in trial #2. Then text.slot_10.currentitem in the data file row for trial #2 will still display the value "x" (because that item was selected in the previous trial and is still the text element's current item).

Instead of logging the currentitem properties, you could also simply log the various values you already have in your script that record item numbers, i.e. values.slot_01_item and so forth. And if you want to avoide the currentitem issue outlined above, simply set those values all to "" at the very beginning of each round /ontrialbegin before you do anything else in <trial example>.

Great! It works well now! Thank you so much!
Another small issue we have had and failed to solve (if there is a way to solve it, that would be great; if not, we will figure out a way in R when we clean the data) is:
trialnum tracks every stimulus. so even if we set those trials to not record data, trialnum still increases a lot.
For example, for the first trial (where n = 10), the relevant trialnum can be 1, 12, ... (because there are 10 trials for stimuli)
Is there a way to make the 12 be 2?

The only way is to forego the built-in trialnum and instead create a <values> entry, increase it by 1 at the start of every round and log that value instead of trialnum.

Awesome! (finally knew what to do...) Now it works great!
Thank you very much!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search