Random draw no replacements


Random draw no replacements

Author
Message
Kim Lien
Kim Lien
Associate Member
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)

Group: Forum Members
Posts: 4, Visits: 5
Dear all,

I would like to make a modification to the Point Subtraction Aggression Paradigm which script can be found on the Millisecond website. 

I'd like to show an item on random draws of specified intervals (called stealinterval in the script). So that I can control that the item will be shown 9 times but the program randomly decides the intervals in which the item will be shown. 

I now ask inquisit to randomly draw an interval (later multiplied by 1000 to make them seconds) from a list of items. I want no replacement. But when I run this script for 10 minutes I see in the output that the item has been shown 10 or 11 times. --> meaning that it either does do replacements of just starts over again when the list is finished. 

Below you find the pieces of script. 

Any help would be greatly appreciated! 

Many thanks in advance,

Kim Lien 


<list stealinterval>
/items = (10,20,30,40,50,60,70,80,90)
/ selectionmode = random
/ replace = false
</list>





<trial select>

/ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime < values.negcolortime)
trial.select.insertstimulustime(text.points_red, 0)]

/ ontrialbegin = [if (values.poscolortime !=0 && script.elapsedtime > values.poscolortime)
{
values.poscolortime = 0}]
/ ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime > values.negcolortime)
{
values.negcolortime = 0}]

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]

/ ontrialbegin = [if (values.protection == 1 && script.elapsedtime >= values.protectiontime)
{
values.protection = 0;
values.protectiontime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000)}]

/ ontrialbegin = [if (values.protection == 0 && script.elapsedtime >= values.procovationtime) {
values.totalpoints -= values.provocationpoints;
values.count_provocations += 1;
values.negcolortime = script.elapsedtime + 1000;
values.poscolortime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000);
trial.select.insertstimulustime(text.points_red, 0)}]

/ stimulusframes = [1 = points, letterA, letterB, letterC, presscounter, presscounterdesc, pointcounter]

/ isvalidresponse = [trial.select.response == values.key1 || trial.select.response == values.key2 || trial.select.response == values.key3]
/ monkeyresponse = (values.key1, values.key2, values.key3)
/timeout = (500)
/ontrialend = [trial.select.resetstimulusframes()]
/branch = [if (trial.select.response != values.key1 && trial.select.response != values.key2 && trial.select.response != values.key3) trial.select]
/ branch = [if (trial.select.response == values.key1) {text.letterA.textcolor = blue; text.letterB.textcolor = white; text.letterC.textcolor = white; values.total_A += 1; trial.optionA_start}]
/ branch = [if (trial.select.response == values.key2) {text.letterB.textcolor = blue; text.letterA.textcolor = white; text.letterC.textcolor = white;values.total_B += 1; trial.optionB_start}]
/ branch = [if (trial.select.response == values.key3) {text.letterC.textcolor = blue; text.letterA.textcolor = white; text.letterB.textcolor = white;values.total_C += 1; trial.optionC_start}]/recorddata = true
</trial>


Dave
Dave
Supreme Being
Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)

Group: Administrators
Posts: 9.1K, Visits: 39K
Kim Lien - Tuesday, April 10, 2018
Dear all,

I would like to make a modification to the Point Subtraction Aggression Paradigm which script can be found on the Millisecond website. 

I'd like to show an item on random draws of specified intervals (called stealinterval in the script). So that I can control that the item will be shown 9 times but the program randomly decides the intervals in which the item will be shown. 

I now ask inquisit to randomly draw an interval (later multiplied by 1000 to make them seconds) from a list of items. I want no replacement. But when I run this script for 10 minutes I see in the output that the item has been shown 10 or 11 times. --> meaning that it either does do replacements of just starts over again when the list is finished. 

Below you find the pieces of script. 

Any help would be greatly appreciated! 

Many thanks in advance,

Kim Lien 


<list stealinterval>
/items = (10,20,30,40,50,60,70,80,90)
/ selectionmode = random
/ replace = false
</list>





<trial select>

/ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime < values.negcolortime)
trial.select.insertstimulustime(text.points_red, 0)]

/ ontrialbegin = [if (values.poscolortime !=0 && script.elapsedtime > values.poscolortime)
{
values.poscolortime = 0}]
/ ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime > values.negcolortime)
{
values.negcolortime = 0}]

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]

/ ontrialbegin = [if (values.protection == 1 && script.elapsedtime >= values.protectiontime)
{
values.protection = 0;
values.protectiontime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000)}]

/ ontrialbegin = [if (values.protection == 0 && script.elapsedtime >= values.procovationtime) {
values.totalpoints -= values.provocationpoints;
values.count_provocations += 1;
values.negcolortime = script.elapsedtime + 1000;
values.poscolortime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000);
trial.select.insertstimulustime(text.points_red, 0)}]

/ stimulusframes = [1 = points, letterA, letterB, letterC, presscounter, presscounterdesc, pointcounter]

/ isvalidresponse = [trial.select.response == values.key1 || trial.select.response == values.key2 || trial.select.response == values.key3]
/ monkeyresponse = (values.key1, values.key2, values.key3)
/timeout = (500)
/ontrialend = [trial.select.resetstimulusframes()]
/branch = [if (trial.select.response != values.key1 && trial.select.response != values.key2 && trial.select.response != values.key3) trial.select]
/ branch = [if (trial.select.response == values.key1) {text.letterA.textcolor = blue; text.letterB.textcolor = white; text.letterC.textcolor = white; values.total_A += 1; trial.optionA_start}]
/ branch = [if (trial.select.response == values.key2) {text.letterB.textcolor = blue; text.letterA.textcolor = white; text.letterC.textcolor = white;values.total_B += 1; trial.optionB_start}]
/ branch = [if (trial.select.response == values.key3) {text.letterC.textcolor = blue; text.letterA.textcolor = white; text.letterB.textcolor = white;values.total_C += 1; trial.optionC_start}]/recorddata = true
</trial>


> just starts over again when the list is finished.

That's exactly what happens and is how lists are supposed to behave. When a list is set to sampling without replacement, it does that, but once all items have been sampled, the list resets, i.e. all items become available for sampling again (without replacement).

I'm not quite sure what the intended end result is supposed to be, but if you merely want to prevent further sampling once all items in the <list> have been sampled once, then making the selection of a new value from the list conditional on the list's unselectedcount property should work:

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0 && list.stealinterval.unselectedcount > 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]
...
(and so forth for any other logic where sampling from the list occurs)

Edited
6 Months Ago by Dave
Kim Lien
Kim Lien
Associate Member
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)

Group: Forum Members
Posts: 4, Visits: 5
Dave - Tuesday, April 10, 2018
Kim Lien - Tuesday, April 10, 2018
Dear all,

I would like to make a modification to the Point Subtraction Aggression Paradigm which script can be found on the Millisecond website. 

I'd like to show an item on random draws of specified intervals (called stealinterval in the script). So that I can control that the item will be shown 9 times but the program randomly decides the intervals in which the item will be shown. 

I now ask inquisit to randomly draw an interval (later multiplied by 1000 to make them seconds) from a list of items. I want no replacement. But when I run this script for 10 minutes I see in the output that the item has been shown 10 or 11 times. --> meaning that it either does do replacements of just starts over again when the list is finished. 

Below you find the pieces of script. 

Any help would be greatly appreciated! 

Many thanks in advance,

Kim Lien 


<list stealinterval>
/items = (10,20,30,40,50,60,70,80,90)
/ selectionmode = random
/ replace = false
</list>





<trial select>

/ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime < values.negcolortime)
trial.select.insertstimulustime(text.points_red, 0)]

/ ontrialbegin = [if (values.poscolortime !=0 && script.elapsedtime > values.poscolortime)
{
values.poscolortime = 0}]
/ ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime > values.negcolortime)
{
values.negcolortime = 0}]

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]

/ ontrialbegin = [if (values.protection == 1 && script.elapsedtime >= values.protectiontime)
{
values.protection = 0;
values.protectiontime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000)}]

/ ontrialbegin = [if (values.protection == 0 && script.elapsedtime >= values.procovationtime) {
values.totalpoints -= values.provocationpoints;
values.count_provocations += 1;
values.negcolortime = script.elapsedtime + 1000;
values.poscolortime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000);
trial.select.insertstimulustime(text.points_red, 0)}]

/ stimulusframes = [1 = points, letterA, letterB, letterC, presscounter, presscounterdesc, pointcounter]

/ isvalidresponse = [trial.select.response == values.key1 || trial.select.response == values.key2 || trial.select.response == values.key3]
/ monkeyresponse = (values.key1, values.key2, values.key3)
/timeout = (500)
/ontrialend = [trial.select.resetstimulusframes()]
/branch = [if (trial.select.response != values.key1 && trial.select.response != values.key2 && trial.select.response != values.key3) trial.select]
/ branch = [if (trial.select.response == values.key1) {text.letterA.textcolor = blue; text.letterB.textcolor = white; text.letterC.textcolor = white; values.total_A += 1; trial.optionA_start}]
/ branch = [if (trial.select.response == values.key2) {text.letterB.textcolor = blue; text.letterA.textcolor = white; text.letterC.textcolor = white;values.total_B += 1; trial.optionB_start}]
/ branch = [if (trial.select.response == values.key3) {text.letterC.textcolor = blue; text.letterA.textcolor = white; text.letterB.textcolor = white;values.total_C += 1; trial.optionC_start}]/recorddata = true
</trial>


> just starts over again when the list is finished.

That's exactly what happens and is how lists are supposed to behave. When a list is set to sampling without replacement, it does that, but once all items have been sampled, the list resets, i.e. all items become available for sampling again (without replacement).

I'm not quite sure what the intended end result is supposed to be, but if you merely want to prevent further sampling once all items in the <list> have been sampled once, then making the selection of a new value from the list conditional on the list's unselectedcount property should work:

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0 && list.stealinterval.unselectedcount > 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]
...
(and so forth for any other logic where sampling from the list occurs)

Dear Dave,

Thank you so much for your quick reply.

I am actually trying to program a max amount of provocations, say 4.

I tried to use your suggestion, but it didn't seem to work.

/ ontrialbegin = [if (values.protection ==0 && values.procovationtime == 0 && values.provocationpoints <4 ) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]

Any advice would help, thanks!

Best,
Kim Lien

















Dave
Dave
Supreme Being
Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)Supreme Being (494K reputation)

Group: Administrators
Posts: 9.1K, Visits: 39K
Kim Lien - Wednesday, April 11, 2018
Dave - Tuesday, April 10, 2018
Kim Lien - Tuesday, April 10, 2018
Dear all,

I would like to make a modification to the Point Subtraction Aggression Paradigm which script can be found on the Millisecond website. 

I'd like to show an item on random draws of specified intervals (called stealinterval in the script). So that I can control that the item will be shown 9 times but the program randomly decides the intervals in which the item will be shown. 

I now ask inquisit to randomly draw an interval (later multiplied by 1000 to make them seconds) from a list of items. I want no replacement. But when I run this script for 10 minutes I see in the output that the item has been shown 10 or 11 times. --> meaning that it either does do replacements of just starts over again when the list is finished. 

Below you find the pieces of script. 

Any help would be greatly appreciated! 

Many thanks in advance,

Kim Lien 


<list stealinterval>
/items = (10,20,30,40,50,60,70,80,90)
/ selectionmode = random
/ replace = false
</list>





<trial select>

/ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime < values.negcolortime)
trial.select.insertstimulustime(text.points_red, 0)]

/ ontrialbegin = [if (values.poscolortime !=0 && script.elapsedtime > values.poscolortime)
{
values.poscolortime = 0}]
/ ontrialbegin = [if (values.negcolortime !=0 && script.elapsedtime > values.negcolortime)
{
values.negcolortime = 0}]

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]

/ ontrialbegin = [if (values.protection == 1 && script.elapsedtime >= values.protectiontime)
{
values.protection = 0;
values.protectiontime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000)}]

/ ontrialbegin = [if (values.protection == 0 && script.elapsedtime >= values.procovationtime) {
values.totalpoints -= values.provocationpoints;
values.count_provocations += 1;
values.negcolortime = script.elapsedtime + 1000;
values.poscolortime = 0;
values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue*1000);
trial.select.insertstimulustime(text.points_red, 0)}]

/ stimulusframes = [1 = points, letterA, letterB, letterC, presscounter, presscounterdesc, pointcounter]

/ isvalidresponse = [trial.select.response == values.key1 || trial.select.response == values.key2 || trial.select.response == values.key3]
/ monkeyresponse = (values.key1, values.key2, values.key3)
/timeout = (500)
/ontrialend = [trial.select.resetstimulusframes()]
/branch = [if (trial.select.response != values.key1 && trial.select.response != values.key2 && trial.select.response != values.key3) trial.select]
/ branch = [if (trial.select.response == values.key1) {text.letterA.textcolor = blue; text.letterB.textcolor = white; text.letterC.textcolor = white; values.total_A += 1; trial.optionA_start}]
/ branch = [if (trial.select.response == values.key2) {text.letterB.textcolor = blue; text.letterA.textcolor = white; text.letterC.textcolor = white;values.total_B += 1; trial.optionB_start}]
/ branch = [if (trial.select.response == values.key3) {text.letterC.textcolor = blue; text.letterA.textcolor = white; text.letterB.textcolor = white;values.total_C += 1; trial.optionC_start}]/recorddata = true
</trial>


> just starts over again when the list is finished.

That's exactly what happens and is how lists are supposed to behave. When a list is set to sampling without replacement, it does that, but once all items have been sampled, the list resets, i.e. all items become available for sampling again (without replacement).

I'm not quite sure what the intended end result is supposed to be, but if you merely want to prevent further sampling once all items in the <list> have been sampled once, then making the selection of a new value from the list conditional on the list's unselectedcount property should work:

/ ontrialbegin = [if (values.protection == 0 && values.procovationtime == 0 && list.stealinterval.unselectedcount > 0) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]
...
(and so forth for any other logic where sampling from the list occurs)

Dear Dave,

Thank you so much for your quick reply.

I am actually trying to program a max amount of provocations, say 4.

I tried to use your suggestion, but it didn't seem to work.

/ ontrialbegin = [if (values.protection ==0 && values.procovationtime == 0 && values.provocationpoints <4 ) values.procovationtime = script.elapsedtime + (list.stealinterval.nextvalue * 1000)]

Any advice would help, thanks!

Best,
Kim Lien

















The number of provocations is tracked by values.count_provocations, not values.provocationpoints.

GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search