Millisecond Forums

Question about random selecting stimuli

https://forums.millisecond.com/Topic22889.aspx

By Kate61 - 11/18/2017

Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate
By Dave - 11/20/2017

Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.
By Kate61 - 11/20/2017

Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!
By Dave - 11/20/2017

Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.
By Kate61 - 11/20/2017

Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

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

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

Here are the random locations:

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!
By Kate61 - 11/20/2017

Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

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

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

Here are the random locations:

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!

This might be a better example (without pictures and more simplified)!

<text 1>
/items = ("1","2","3","4","5","6","7","8","9")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<text A>
/items = ("A","B","C"."D","E","F","G","H","I")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

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


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

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = alwayss
</counter>

<list picturestims>
/ items = (text.1,text.A)
/ replace = true
/ selectionrate = always
</list>

<list locations>
/ items = (counter.faceXpos_grid,counter.faceYpos_grid)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]


By Dave - 11/20/2017

Kate61 - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

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

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

Here are the random locations:

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!

This might be a better example (without pictures and more simplified)!

<text 1>
/items = ("1","2","3","4","5","6","7","8","9")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<text A>
/items = ("A","B","C"."D","E","F","G","H","I")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

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


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

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = alwayss
</counter>

<list picturestims>
/ items = (text.1,text.A)
/ replace = true
/ selectionrate = always
</list>

<list locations>
/ items = (counter.faceXpos_grid,counter.faceYpos_grid)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]



Thanks for the additional details -- in light of those details, I would advocate a different kind of approach. Ultimately, you need 14 <picture> elements if you want the trial to display 14 distinct objects on-screen. You can consider those 14 <picture> elements as neutral "slots" -- i.e. they are not tied to any particular stimulus category per se. You would use <list> elements to store the grid positions, and -- more importantly -- <list> elements holding the item numbers constituting the various stimulus "categories" "WM", WF", "BM", and "BF"). Then, in each trial you would assign (1) a grid position, and (2) an item number to each of the 14 neutral slots.

In a nutshell:


// 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>

// fill the first four "slots" by sampling from this list
// to ensure that at least one item of each category is represented in each trial:
<list firstfour>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = false
/ selectionrate = always
</list>

// fill the remaining ten "slots" by sampling from this list
<list remainingten>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = true
/ 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:
<trial example>
/ 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;
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    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();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08, slot_09, slot_10, slot_11, slot_12, slot_13, slot_14]
/ validresponse = (57)
</trial>

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

You can determine the number of items from a given category that were shown during a given trial by logging and/or further processing the values.slot_01_item to values.slot_14_item variables.

I hope the above gives you the general idea.

By Kate61 - 11/20/2017

Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

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

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

Here are the random locations:

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!

This might be a better example (without pictures and more simplified)!

<text 1>
/items = ("1","2","3","4","5","6","7","8","9")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<text A>
/items = ("A","B","C"."D","E","F","G","H","I")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

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


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

<counter 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%)
/select = noreplace
/selectionrate = always
</counter>

<counter 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%)
/select = current(faceXpos_grid)
/selectionrate = alwayss
</counter>

<list picturestims>
/ items = (text.1,text.A)
/ replace = true
/ selectionrate = always
</list>

<list locations>
/ items = (counter.faceXpos_grid,counter.faceYpos_grid)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]



Thanks for the additional details -- in light of those details, I would advocate a different kind of approach. Ultimately, you need 14 <picture> elements if you want the trial to display 14 distinct objects on-screen. You can consider those 14 <picture> elements as neutral "slots" -- i.e. they are not tied to any particular stimulus category per se. You would use <list> elements to store the grid positions, and -- more importantly -- <list> elements holding the item numbers constituting the various stimulus "categories" "WM", WF", "BM", and "BF"). Then, in each trial you would assign (1) a grid position, and (2) an item number to each of the 14 neutral slots.

In a nutshell:


// 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>

// fill the first four "slots" by sampling from this list
// to ensure that at least one item of each category is represented in each trial:
<list firstfour>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = false
/ selectionrate = always
</list>

// fill the remaining ten "slots" by sampling from this list
<list remainingten>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = true
/ 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:
<trial example>
/ 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;
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    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();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08, slot_09, slot_10, slot_11, slot_12, slot_13, slot_14]
/ validresponse = (57)
</trial>

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

You can determine the number of items from a given category that were shown during a given trial by logging and/or further processing the values.slot_01_item to values.slot_14_item variables.

I hope the above gives you the general idea.


Thank you so much, Dave! This is extremely helpful!!
I tried it and all worked wonderfully!
Thank you!!
By Kate61 - 12/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!
By Dave - 12/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.
By Kate61 - 12/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!



By Dave - 12/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!

By Kate61 - 12/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!
By Dave - 12/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.
By Kate61 - 12/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


By Dave - 12/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?
By Kate61 - 12/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!
By Dave - 12/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>


By Kate61 - 5/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!


By Dave - 5/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.
By Kate61 - 5/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...


By Dave - 5/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.
By Kate61 - 5/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...
By Kate61 - 5/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...

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!
By Dave - 5/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>.
By Kate61 - 5/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?
By Dave - 5/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.