enable experimenter to decide the number of trials per type in a block


enable experimenter to decide the number of trials per type in a block...
Author
Message
tecnika
tecnika
Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)
Group: Forum Members
Posts: 156, Visits: 790
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




tecnika
tecnika
Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)
Group: Forum Members
Posts: 156, Visits: 790
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
tecnika - Tuesday, September 18, 2018
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

tecnika
tecnika
Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)
Group: Forum Members
Posts: 156, Visits: 790
Dave - Tuesday, September 18, 2018
tecnika - Tuesday, September 18, 2018
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
tecnika - Tuesday, September 18, 2018
Dave - Tuesday, September 18, 2018
tecnika - Tuesday, September 18, 2018
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

The list should have a proper poolsize specified or set, i.e. poolsize should be set equal to the total amount of trials. Otherwise something's off with your calculations.

tecnika
tecnika
Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)
Group: Forum Members
Posts: 156, Visits: 790
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

The list should have a proper poolsize specified or set, i.e. poolsize should be set equal to the total amount of trials. Otherwise something's off with your calculations.


Hi Dave,

This is how it should be already, shouldn't it?

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]




tecnika
tecnika
Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)
Group: Forum Members
Posts: 156, Visits: 790
tecnika - Wednesday, September 19, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

The list should have a proper poolsize specified or set, i.e. poolsize should be set equal to the total amount of trials. Otherwise something's off with your calculations.


Hi Dave,

This is how it should be already, shouldn't it?

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]




<textbox nrTrialsTest>
/ caption = "
NR TEST TRIALS - The number of trials in the Test is:"
/ required = true
/ position = (10%, 85%)
/ mask = integer
</textbox>

(Sorry for the multiple post, but I could not paste into the forum).
When I set up itemprobabilities (0.20, 0.80) on 10 trials, I would expect 2 items of one type and 8 of the other type. What I can see in one or more occasion are 3 items of one type and 7 of the other type...

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
tecnika - Wednesday, September 19, 2018
tecnika - Wednesday, September 19, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

The list should have a proper poolsize specified or set, i.e. poolsize should be set equal to the total amount of trials. Otherwise something's off with your calculations.


Hi Dave,

This is how it should be already, shouldn't it?

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]




<textbox nrTrialsTest>
/ caption = "
NR TEST TRIALS - The number of trials in the Test is:"
/ required = true
/ position = (10%, 85%)
/ mask = integer
</textbox>

(Sorry for the multiple post, but I could not paste into the forum).
When I set up itemprobabilities (0.20, 0.80) on 10 trials, I would expect 2 items of one type and 8 of the other type. What I can see in one or more occasion are 3 items of one type and 7 of the other type...

Found the issue, should have realized this yesterday:

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]
</list>

This won't work, because the list keeps the state values.probabilityCue1 and values.probabilityCue2 were in when the list was initially parsed. That's actually intended / by design. The proper way to change the item probabilities is to set the two properties as in:

<values>
/ probabilityCue1 = 0.5
/ probabilityCue2 = 0.5
/ cuenum = 1
/ trialcount = 0
/ ntrials = 0
</values>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]
</list>

<surveypage settings>
/ ontrialend = [
    values.probabilityCue1 = textbox.p1.response;
    values.probabilityCue2 = textbox.p2.response;
    values.ntrials = textbox.ntrials.response;
    list.Cue_random.itemprobabilities.1 = values.probabilityCue1;
    list.Cue_random.itemprobabilities.2 = values.probabilityCue2;

    list.Cue_random.poolsize = values.ntrials;
]
/ questions = [1=p1; 2=p2; 3=ntrials]
</surveypage>

<textbox p1>
/ caption = "prob1:"
/ mask = decimal
</textbox>
<textbox p2>
/ caption = "prob2:"
/ mask = decimal
</textbox>
<textbox ntrials>
/ caption = "total number of trials:"
/ mask = positiveinteger
</textbox>

<block settingsblock>
/ trials = [1=settings]
</block>

<block trialblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.trialcount +=1;
    values.cuenum = list.Cue_random.nextvalue;
]
/ stimulusframes = [1=cue]
/ validresponse = (57)
/ branch = [
    if (values.trialcount < values.ntrials) trial.mytrial;
]
</trial>

<text cue>
/ items = ("C1", "C2")
/ select = values.cuenum
</text>

<data>
/ separatefiles = true
</data>

tecnika
tecnika
Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)Guru (13K reputation)
Group: Forum Members
Posts: 156, Visits: 790
Dave - Wednesday, September 19, 2018
tecnika - Wednesday, September 19, 2018
tecnika - Wednesday, September 19, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

The list should have a proper poolsize specified or set, i.e. poolsize should be set equal to the total amount of trials. Otherwise something's off with your calculations.


Hi Dave,

This is how it should be already, shouldn't it?

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]




<textbox nrTrialsTest>
/ caption = "
NR TEST TRIALS - The number of trials in the Test is:"
/ required = true
/ position = (10%, 85%)
/ mask = integer
</textbox>

(Sorry for the multiple post, but I could not paste into the forum).
When I set up itemprobabilities (0.20, 0.80) on 10 trials, I would expect 2 items of one type and 8 of the other type. What I can see in one or more occasion are 3 items of one type and 7 of the other type...

Found the issue, should have realized this yesterday:

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]
</list>

This won't work, because the list keeps the state values.probabilityCue1 and values.probabilityCue2 were in when the list was initially parsed. That's actually intended / by design. The proper way to change the item probabilities is to set the two properties as in:

<values>
/ probabilityCue1 = 0.5
/ probabilityCue2 = 0.5
/ cuenum = 1
/ trialcount = 0
/ ntrials = 0
</values>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]
</list>

<surveypage settings>
/ ontrialend = [
    values.probabilityCue1 = textbox.p1.response;
    values.probabilityCue2 = textbox.p2.response;
    values.ntrials = textbox.ntrials.response;
    list.Cue_random.itemprobabilities.1 = values.probabilityCue1;
    list.Cue_random.itemprobabilities.2 = values.probabilityCue2;

    list.Cue_random.poolsize = values.ntrials;
]
/ questions = [1=p1; 2=p2; 3=ntrials]
</surveypage>

<textbox p1>
/ caption = "prob1:"
/ mask = decimal
</textbox>
<textbox p2>
/ caption = "prob2:"
/ mask = decimal
</textbox>
<textbox ntrials>
/ caption = "total number of trials:"
/ mask = positiveinteger
</textbox>

<block settingsblock>
/ trials = [1=settings]
</block>

<block trialblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.trialcount +=1;
    values.cuenum = list.Cue_random.nextvalue;
]
/ stimulusframes = [1=cue]
/ validresponse = (57)
/ branch = [
    if (values.trialcount < values.ntrials) trial.mytrial;
]
</trial>

<text cue>
/ items = ("C1", "C2")
/ select = values.cuenum
</text>

<data>
/ separatefiles = true
</data>

Hi Dave,
I had a go and it does 0.50 as probabilities if I put it like that, not sure if I have done it right.
When I set the probabilities in the trial, the number of trials per type is almost right... I believe there are problems with having to transform the total number of trials in decimal point, so the exact number got lost maybe? e.g. I set the number of one type of trial as 31 out a total of 260 trials. Instead of presenting 31 trials of that type, it presents 33. 
Is there any other way to set up the exact number of trials? ... probably with a counter?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
tecnika - Thursday, September 20, 2018
Dave - Wednesday, September 19, 2018
tecnika - Wednesday, September 19, 2018
tecnika - Wednesday, September 19, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
Dave - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
+x
tecnika - Tuesday, September 18, 2018
Hi Dave,

In a block with two different type of trials I would like to "enable" the experimenter to choose how many trials per type to run.
The trials will need to be randomised in the block.

I have done this presenting in the instructions a textbox where the experimenter type the total number of trials and then a slide when s/he can specify the probability a certain type of trial is presented.

It works fine-ish with a list and setting the pool as the total number of trials and the item probabilities as a slider in the instructions that the experimenter can select.

However, rather than using the decimal value as itemprobabilities I would like to use the exact number of trials per type, so I can make sure that the exact number of trials is presented per type.

As one option I was thinking to allow the experimenter to exact the number of trials per type (as integer) and then transforming it in decimal points (that similar to what I am doing) but I was wondering if there was another options.

Thanks




<trial TestInstructions>
/ ontrialbegin = [values.probabilityCue1 = 0]
/ ontrialbegin = [values.probabilityCue2 = 0]
/ inputdevice = mouse
/ stimulustimes = [1 = TestInstructions, Buttons]
/ validresponse = (Buttons)
/ recorddata = false
/ branch = [trial.ITI]
/ ontrialend = [values.pCue1 = textbox.probabilitiesCueGnG.response/textbox.nrTrialsTest.response]
/ ontrialend = [values.pCue2 = format("%.2f", 1.00-values.pCue1)]
/ ontrialend = [values.probabilityCue1 = format("%.2f", values.pCue1)]
/ ontrialend = [values.probabilityCue2 = values.pCue2]
/ ontrialend = [values.expBlock = "Test"]
</trial>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]

and here's one example of trial

<trial 1_tap_V_Cue_Test>
/ ontrialbegin = [values.selectedResp = 0;]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "Go_noGo") values.selectedResp = radiobuttons.ResponseStimulusGnG.response]
/ ontrialend = [if (trial.1_tap_V_Cue_Test.response == "skip") values.selectedResp = "skip"]

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {values.currentCue=list.Cue_random.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "predetermined") {values.currentCue=list.Cue_sequence.nextvalue; }]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.1 = values.probabilityCue1;}]
/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.itemprobabilities.2 = values.probabilityCue2;}]
/ ontrialbegin = [values.GnG_timeout = textbox.timeoutGnG.response]
/ ontrialbegin = [values.nr_testTrial += 1]
/ ontrialbegin = [values.nr_practiceTrial = 0]
/ ontrialbegin = [picture.Visual_Cue.hposition = 50%; picture.Visual_Cue.vposition = 20%;]
/ inputdevice = mouse
/ stimulustimes = [1 = Go_noGo; 200 = Visual_Cue, Go_noGo, skip]

/ iscorrectresponse = [(values.currentcue != values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "Go_noGo")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == "skip")
|| (values.currentcue == values.GnG_responseImage && trial.1_tap_V_Cue_Test.response == 0)]

/ ontrialend = [if (values.currentCue == values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_falseAlarms += 1;}
else if (values.selectedResp == "skip") {values.GnG_correctRejections += 1;}
else if (values.selectedResp == "0") {values.GnG_correctRejections += 1;}}]
/ ontrialend = [if (values.currentCue != values.GnG_responseImage)
{if (values.selectedResp == values.GnG_responseImage) {values.GnG_hits += 1;}
else if (values.selectedResp == "skip") {values.GnG_misses += 1;}
else if (values.selectedResp == "0") {values.GnG_misses += 1;}}]

/ timeout = values.GnG_timeout*1000 + 200
/ showmousecursor = true
/ validresponse = (Go_noGo, skip)
/ branch = [if (values.nr_testTrial < textbox.nrTrialsTest.response) trial.1_tap_V_Cue_test else trial.End]
</trial>


Item probabilities have to be specified as decimals, so your approach seems like the one to pursue, i.e. convert number of trials indicated to decimals. At least I can't really think of a better one.

thank you Dave for your reply. The fact is the number is never exact ... for instance, if the probability is 0.20 sometimes I got 3 out of then trials of on type... and I cannot explain that. Maybe is there something that need to be specifies in the list?

The list should have a proper poolsize specified or set, i.e. poolsize should be set equal to the total amount of trials. Otherwise something's off with your calculations.


Hi Dave,

This is how it should be already, shouldn't it?

/ ontrialbegin = [if (dropdown.CueOrder.response == "random") {list.Cue_random.poolsize = textbox.nrTrialsTest.response;}]




<textbox nrTrialsTest>
/ caption = "
NR TEST TRIALS - The number of trials in the Test is:"
/ required = true
/ position = (10%, 85%)
/ mask = integer
</textbox>

(Sorry for the multiple post, but I could not paste into the forum).
When I set up itemprobabilities (0.20, 0.80) on 10 trials, I would expect 2 items of one type and 8 of the other type. What I can see in one or more occasion are 3 items of one type and 7 of the other type...

Found the issue, should have realized this yesterday:

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]
</list>

This won't work, because the list keeps the state values.probabilityCue1 and values.probabilityCue2 were in when the list was initially parsed. That's actually intended / by design. The proper way to change the item probabilities is to set the two properties as in:

<values>
/ probabilityCue1 = 0.5
/ probabilityCue2 = 0.5
/ cuenum = 1
/ trialcount = 0
/ ntrials = 0
</values>

<list Cue_random>
/ items = (1, 2)
/ poolsize = 2
/ replace = false
/ selectionmode = random
/ itemprobabilities = [values.probabilityCue1; values.probabilityCue2]
</list>

<surveypage settings>
/ ontrialend = [
    values.probabilityCue1 = textbox.p1.response;
    values.probabilityCue2 = textbox.p2.response;
    values.ntrials = textbox.ntrials.response;
    list.Cue_random.itemprobabilities.1 = values.probabilityCue1;
    list.Cue_random.itemprobabilities.2 = values.probabilityCue2;

    list.Cue_random.poolsize = values.ntrials;
]
/ questions = [1=p1; 2=p2; 3=ntrials]
</surveypage>

<textbox p1>
/ caption = "prob1:"
/ mask = decimal
</textbox>
<textbox p2>
/ caption = "prob2:"
/ mask = decimal
</textbox>
<textbox ntrials>
/ caption = "total number of trials:"
/ mask = positiveinteger
</textbox>

<block settingsblock>
/ trials = [1=settings]
</block>

<block trialblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.trialcount +=1;
    values.cuenum = list.Cue_random.nextvalue;
]
/ stimulusframes = [1=cue]
/ validresponse = (57)
/ branch = [
    if (values.trialcount < values.ntrials) trial.mytrial;
]
</trial>

<text cue>
/ items = ("C1", "C2")
/ select = values.cuenum
</text>

<data>
/ separatefiles = true
</data>

Hi Dave,
I had a go and it does 0.50 as probabilities if I put it like that, not sure if I have done it right.
When I set the probabilities in the trial, the number of trials per type is almost right... I believe there are problems with having to transform the total number of trials in decimal point, so the exact number got lost maybe? e.g. I set the number of one type of trial as 31 out a total of 260 trials. Instead of presenting 31 trials of that type, it presents 33. 
Is there any other way to set up the exact number of trials? ... probably with a counter?

There is another way, you can essentially leave the <list> empty and then populate it with items (here: the digits 1 and 2) as needed per dummy trials. Here's an example:

<values>
/ nCue1 = 0
/ nCue2 = 0
/ cuenum = 1
/ cue1count = 0
/ cue2count = 0
/ trialcount = 0
/ ntrials = 0
</values>

<list Cue_random>
</list>

<surveypage settings>
/ ontrialend = [
    values.nCue1 = textbox.n1.response;
    values.nCue2 = textbox.n2.response;
    values.ntrials = values.nCue1 + values.nCue2;
    ]
/ questions = [1=n1; 2=n2;]
/ branch = [
    trial.setup_cue1_trials;
]
</surveypage>

<textbox n1>
/ caption = "Number of Type 1 Trials:"
/ mask  = positiveintegerorzero
</textbox>
<textbox n2>
/ caption = "Number of Type 2 Trials:"
/ mask  = positiveintegerorzero
</textbox>

<trial setup_cue1_trials>
/ ontrialbegin = [
    values.cue1count += 1;
    list.Cue_random.insertitem(1, 1);
]
/ trialduration = 0
/ branch = [
    if (values.cue1count < values.nCue1) trial.setup_cue1_trials else trial.setup_cue2_trials;
]
/ recorddata = false
</trial>

<trial setup_cue2_trials>
/ ontrialbegin = [
    values.cue2count += 1;
    list.Cue_random.insertitem(2, 1);
]
/ trialduration = 0
/ branch = [
    if (values.cue2count < values.nCue2) trial.setup_cue2_trials;
]
/ recorddata = false
</trial>

<expt>
/ blocks = [1=settingsblock; 2=trialblock]
</expt>

<block settingsblock>
/ trials = [1=settings]
</block>

<block trialblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [
    values.trialcount +=1;
    values.cuenum = list.Cue_random.nextvalue;
]
/ stimulusframes = [1=cue]
/ validresponse = (57)
/ branch = [
    if (values.trialcount < values.ntrials) trial.mytrial;
]
</trial>

<text cue>
/ items = ("C1", "C2")
/ select = values.cuenum
</text>

<data>
/ separatefiles = true
</data>

That would eliminate the need to worry about any rounding issues with the item probabilities, you should get exactly the discrete amounts of trials you entered in the mask.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search