ivy.c
|
|
Group: Forum Members
Posts: 11,
Visits: 148
|
Hello,
My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions.
I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant.
In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial?
I have attached my script for details. Thank you so much in advance!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc.
|
|
|
ivy.c
|
|
Group: Forum Members
Posts: 11,
Visits: 148
|
+x+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc. Hi Dave, Thank you for your reply. Could you provide a bit more clarification regarding the step about retrieving the nth value and storing it as a value? Am I creating a separate item from the list I've sorted at the end of the block? I'm just a little unclear how to adapt the code based on the link you provided. Thank you in advance!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc. Hi Dave, Thank you for your reply. Could you provide a bit more clarification regarding the step about retrieving the nth value and storing it as a value? Am I creating a separate item from the list I've sorted at the end of the block? I'm just a little unclear how to adapt the code based on the link you provided. Thank you in advance! You already have a list containing the correct RTs. So then you sort it in ascending order at the end of the block, calculate the index -- 0.3 * the list's itemcount, rounded to the nearest whole number -- and retrieve the item at that index*: <block shortnoreward_final> / onblockend = [ // sort correct RTs in ascending order list.corrRT.sort(true, false); // calculate index values.index = round(0.3 * list.corrRT.itemcount); // get 30th percentile from list values.cutoff_RT = list.corrRT.item(values.index); ] / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] </block> *There's no universal definition of percentile. In some definitions the index value is taken as the percentile value. In others, it's value after that in the sorted data set, in again others, the percentile value is taken as the average of those two values, so adjust the calculatin according to your preferences.
|
|
|
ivy.c
|
|
Group: Forum Members
Posts: 11,
Visits: 148
|
+x+x+x+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc. Hi Dave, Thank you for your reply. Could you provide a bit more clarification regarding the step about retrieving the nth value and storing it as a value? Am I creating a separate item from the list I've sorted at the end of the block? I'm just a little unclear how to adapt the code based on the link you provided. Thank you in advance! You already have a list containing the correct RTs. So then you sort it in ascending order at the end of the block, calculate the index -- 0.3 * the list's itemcount, rounded to the nearest whole number -- and retrieve the item at that index*: <block shortnoreward_final> / onblockend = [ // sort correct RTs in ascending order list.corrRT.sort(true, false); // calculate index values.index = round(0.3 * list.corrRT.itemcount); // get 30th percentile from list values.cutoff_RT = list.corrRT.item(values.index); ] / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] </block> *There's no universal definition of percentile. In some definitions the index value is taken as the percentile value. In others, it's value after that in the sorted data set, in again others, the percentile value is taken as the average of those two values, so adjust the calculatin according to your preferences. Hi Dave, Thank you so much! That makes sense. I also took your feedback and used the branch attribute to give specific feedback based on the response time or the participant’s answer. However, I have run into the following problems: 1. In addition to having the branch be conditional based on whether the participant is correct/incorrect/responds in time, I’m hoping to set it up so that the feedback presented to the participant is dependent on the “precue” that is presented on that trial. Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&”, but I’m not entirely sure. (Script below): <trial AX_Short_Reward> / inputdevice = keyboard / ontrialbegin = [ values.precue = list.precue.nextvalue; values.cue = "A"; values.probe = "X"; trial.AX_Short_Reward.insertstimulustime(shape.eraser, expressions.precueeraser); trial.AX_Short_Reward.insertstimulustime(text.cue, expressions.cue); trial.AX_Short_Reward.insertstimulustime(text.fixation, expressions.shortdelay); trial.AX_Short_Reward.insertstimulustime(text.probe, expressions.probe_short); ] / stimulustimes = [0 = precue] / ontrialend = [ values.countcorrect += trial.AX_Short_Reward.correct; values.countcorrect_AX_Short_Reward += trial.AX_Short_Reward.correct; list.ACC.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short.appenditem(trial.AX_Short_Reward.correct); list.ACC_Reward.appenditem(trial.AX_Short_Reward.correct); if (trial.AX_Short_Reward.correct){ list.corrRT.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short.appenditem(trial.AX_Short_Reward.latency); }; list.RT.appenditem(trial.AX_Short_Reward.latency); list.RT_AX.appenditem(trial.AX_Short_Reward.latency); list.RT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short.appenditem(trial.AX_Short_Reward.latency); ] / correctresponse = ("E") / validresponse = ("E", "I") / beginresponsetime = 1800 / timeout = 1800+values.cutoff_RT / branch = [ if(trial.AX_Short_Reward.response==0)trial.tooslowfb] / branch = [ if(trial.AX_Short_Reward.error)trial.errorfb] /branch = [ if(trial.AX_Short_Reward.correct)trial.correctfb] / posttrialpause = parameters.iti </trial> <trial correctfb> /stimulustimes = [ 0=correctstim ] / validresponse = (0) / timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> <trial correct_norewardfb> /stimulustimes = [ 0=correct_norewardstim ] /validresponse = (0) /timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> 2. I also created another set of blocks (“longnoreward_final” and “longreward_final”), where I hope to incorporate the same feature where the RT cut-off for the trials in “longreward_final” is the 30th percentile of the RTs from the baseline block (“longnoreward_final”). However, when I run it as the next set of blocks, the value does not seem to be properly updated, and seems to store the value used in block 2 (“shortreard_final”). Is there a way to reset/change this value? Or would I have to create a separate value to be used in block 4 (longreward_final) based on the values from block 3 (longnoreward_final)? (Script below): <block shortnoreward_final> / preinstructions = (intronoreward) / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] / onblockend = [list.corrRT_baseline_short.sort(false,false); values.index = round(0.3*list.corrRT_baseline_short.itemcount); values.cutoff_RT = list.corrRT_baseline_short.item(values.index); ] </block> <block shortreward_final> / preinstructions = (introreward) / trials = [1-10 = noreplace(AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,BX_Short_Reward, AY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward)] </block> <block longnoreward_final> / preinstructions = (intronoreward) /trials = [ 1-10 = noreplace(AX_Long_No,AX_Long_No,AX_Long_No,AX_Long_No,BX_Long_No, AY_Long_No, BY_Long_No, BY_Long_No, BY_Long_No,BY_Long_No,) ] / onblockend = [list.corrRT_baseline_long.sort(false,false); values.index = round(0.3*list.corrRT_baseline_long.itemcount); values.cutoff_RT = list.corrRT_baseline_long.item(values.index); ] </block> <block longreward_final> / preinstructions = (introreward) /trials = [ 1-10 =noreplace(AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,BX_Long_Reward, AY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward) ] </block> Thank you so much in advance!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+x+x+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc. Hi Dave, Thank you for your reply. Could you provide a bit more clarification regarding the step about retrieving the nth value and storing it as a value? Am I creating a separate item from the list I've sorted at the end of the block? I'm just a little unclear how to adapt the code based on the link you provided. Thank you in advance! You already have a list containing the correct RTs. So then you sort it in ascending order at the end of the block, calculate the index -- 0.3 * the list's itemcount, rounded to the nearest whole number -- and retrieve the item at that index*: <block shortnoreward_final> / onblockend = [ // sort correct RTs in ascending order list.corrRT.sort(true, false); // calculate index values.index = round(0.3 * list.corrRT.itemcount); // get 30th percentile from list values.cutoff_RT = list.corrRT.item(values.index); ] / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] </block> *There's no universal definition of percentile. In some definitions the index value is taken as the percentile value. In others, it's value after that in the sorted data set, in again others, the percentile value is taken as the average of those two values, so adjust the calculatin according to your preferences. Hi Dave, Thank you so much! That makes sense. I also took your feedback and used the branch attribute to give specific feedback based on the response time or the participant’s answer. However, I have run into the following problems: 1. In addition to having the branch be conditional based on whether the participant is correct/incorrect/responds in time, I’m hoping to set it up so that the feedback presented to the participant is dependent on the “precue” that is presented on that trial. Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&”, but I’m not entirely sure. (Script below): <trial AX_Short_Reward> / inputdevice = keyboard / ontrialbegin = [ values.precue = list.precue.nextvalue; values.cue = "A"; values.probe = "X"; trial.AX_Short_Reward.insertstimulustime(shape.eraser, expressions.precueeraser); trial.AX_Short_Reward.insertstimulustime(text.cue, expressions.cue); trial.AX_Short_Reward.insertstimulustime(text.fixation, expressions.shortdelay); trial.AX_Short_Reward.insertstimulustime(text.probe, expressions.probe_short); ] / stimulustimes = [0 = precue] / ontrialend = [ values.countcorrect += trial.AX_Short_Reward.correct; values.countcorrect_AX_Short_Reward += trial.AX_Short_Reward.correct; list.ACC.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short.appenditem(trial.AX_Short_Reward.correct); list.ACC_Reward.appenditem(trial.AX_Short_Reward.correct); if (trial.AX_Short_Reward.correct){ list.corrRT.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short.appenditem(trial.AX_Short_Reward.latency); }; list.RT.appenditem(trial.AX_Short_Reward.latency); list.RT_AX.appenditem(trial.AX_Short_Reward.latency); list.RT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short.appenditem(trial.AX_Short_Reward.latency); ] / correctresponse = ("E") / validresponse = ("E", "I") / beginresponsetime = 1800 / timeout = 1800+values.cutoff_RT / branch = [ if(trial.AX_Short_Reward.response==0)trial.tooslowfb] / branch = [ if(trial.AX_Short_Reward.error)trial.errorfb] /branch = [ if(trial.AX_Short_Reward.correct)trial.correctfb] / posttrialpause = parameters.iti </trial> <trial correctfb> /stimulustimes = [ 0=correctstim ] / validresponse = (0) / timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> <trial correct_norewardfb> /stimulustimes = [ 0=correct_norewardstim ] /validresponse = (0) /timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> 2. I also created another set of blocks (“longnoreward_final” and “longreward_final”), where I hope to incorporate the same feature where the RT cut-off for the trials in “longreward_final” is the 30th percentile of the RTs from the baseline block (“longnoreward_final”). However, when I run it as the next set of blocks, the value does not seem to be properly updated, and seems to store the value used in block 2 (“shortreard_final”). Is there a way to reset/change this value? Or would I have to create a separate value to be used in block 4 (longreward_final) based on the values from block 3 (longnoreward_final)? (Script below): <block shortnoreward_final> / preinstructions = (intronoreward) / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] / onblockend = [list.corrRT_baseline_short.sort(false,false); values.index = round(0.3*list.corrRT_baseline_short.itemcount); values.cutoff_RT = list.corrRT_baseline_short.item(values.index); ] </block> <block shortreward_final> / preinstructions = (introreward) / trials = [1-10 = noreplace(AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,BX_Short_Reward, AY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward)] </block> <block longnoreward_final> / preinstructions = (intronoreward) /trials = [ 1-10 = noreplace(AX_Long_No,AX_Long_No,AX_Long_No,AX_Long_No,BX_Long_No, AY_Long_No, BY_Long_No, BY_Long_No, BY_Long_No,BY_Long_No,) ] / onblockend = [list.corrRT_baseline_long.sort(false,false); values.index = round(0.3*list.corrRT_baseline_long.itemcount); values.cutoff_RT = list.corrRT_baseline_long.item(values.index); ] </block> <block longreward_final> / preinstructions = (introreward) /trials = [ 1-10 =noreplace(AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,BX_Long_Reward, AY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward) ] </block> Thank you so much in advance! > Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&” Well, yes. You have the precue in values.precue and you need to fashon branch conditions with a logical and (&&) accordingly. Question 2 is not answerable based on the few code snippets. Are you actually populating list.corrRT_baseline_long with any latencies at all?
|
|
|
ivy.c
|
|
Group: Forum Members
Posts: 11,
Visits: 148
|
+x+x+x+x+x+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc. Hi Dave, Thank you for your reply. Could you provide a bit more clarification regarding the step about retrieving the nth value and storing it as a value? Am I creating a separate item from the list I've sorted at the end of the block? I'm just a little unclear how to adapt the code based on the link you provided. Thank you in advance! You already have a list containing the correct RTs. So then you sort it in ascending order at the end of the block, calculate the index -- 0.3 * the list's itemcount, rounded to the nearest whole number -- and retrieve the item at that index*: <block shortnoreward_final> / onblockend = [ // sort correct RTs in ascending order list.corrRT.sort(true, false); // calculate index values.index = round(0.3 * list.corrRT.itemcount); // get 30th percentile from list values.cutoff_RT = list.corrRT.item(values.index); ] / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] </block> *There's no universal definition of percentile. In some definitions the index value is taken as the percentile value. In others, it's value after that in the sorted data set, in again others, the percentile value is taken as the average of those two values, so adjust the calculatin according to your preferences. Hi Dave, Thank you so much! That makes sense. I also took your feedback and used the branch attribute to give specific feedback based on the response time or the participant’s answer. However, I have run into the following problems: 1. In addition to having the branch be conditional based on whether the participant is correct/incorrect/responds in time, I’m hoping to set it up so that the feedback presented to the participant is dependent on the “precue” that is presented on that trial. Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&”, but I’m not entirely sure. (Script below): <trial AX_Short_Reward> / inputdevice = keyboard / ontrialbegin = [ values.precue = list.precue.nextvalue; values.cue = "A"; values.probe = "X"; trial.AX_Short_Reward.insertstimulustime(shape.eraser, expressions.precueeraser); trial.AX_Short_Reward.insertstimulustime(text.cue, expressions.cue); trial.AX_Short_Reward.insertstimulustime(text.fixation, expressions.shortdelay); trial.AX_Short_Reward.insertstimulustime(text.probe, expressions.probe_short); ] / stimulustimes = [0 = precue] / ontrialend = [ values.countcorrect += trial.AX_Short_Reward.correct; values.countcorrect_AX_Short_Reward += trial.AX_Short_Reward.correct; list.ACC.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short.appenditem(trial.AX_Short_Reward.correct); list.ACC_Reward.appenditem(trial.AX_Short_Reward.correct); if (trial.AX_Short_Reward.correct){ list.corrRT.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short.appenditem(trial.AX_Short_Reward.latency); }; list.RT.appenditem(trial.AX_Short_Reward.latency); list.RT_AX.appenditem(trial.AX_Short_Reward.latency); list.RT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short.appenditem(trial.AX_Short_Reward.latency); ] / correctresponse = ("E") / validresponse = ("E", "I") / beginresponsetime = 1800 / timeout = 1800+values.cutoff_RT / branch = [ if(trial.AX_Short_Reward.response==0)trial.tooslowfb] / branch = [ if(trial.AX_Short_Reward.error)trial.errorfb] /branch = [ if(trial.AX_Short_Reward.correct)trial.correctfb] / posttrialpause = parameters.iti </trial> <trial correctfb> /stimulustimes = [ 0=correctstim ] / validresponse = (0) / timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> <trial correct_norewardfb> /stimulustimes = [ 0=correct_norewardstim ] /validresponse = (0) /timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> 2. I also created another set of blocks (“longnoreward_final” and “longreward_final”), where I hope to incorporate the same feature where the RT cut-off for the trials in “longreward_final” is the 30th percentile of the RTs from the baseline block (“longnoreward_final”). However, when I run it as the next set of blocks, the value does not seem to be properly updated, and seems to store the value used in block 2 (“shortreard_final”). Is there a way to reset/change this value? Or would I have to create a separate value to be used in block 4 (longreward_final) based on the values from block 3 (longnoreward_final)? (Script below): <block shortnoreward_final> / preinstructions = (intronoreward) / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] / onblockend = [list.corrRT_baseline_short.sort(false,false); values.index = round(0.3*list.corrRT_baseline_short.itemcount); values.cutoff_RT = list.corrRT_baseline_short.item(values.index); ] </block> <block shortreward_final> / preinstructions = (introreward) / trials = [1-10 = noreplace(AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,BX_Short_Reward, AY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward)] </block> <block longnoreward_final> / preinstructions = (intronoreward) /trials = [ 1-10 = noreplace(AX_Long_No,AX_Long_No,AX_Long_No,AX_Long_No,BX_Long_No, AY_Long_No, BY_Long_No, BY_Long_No, BY_Long_No,BY_Long_No,) ] / onblockend = [list.corrRT_baseline_long.sort(false,false); values.index = round(0.3*list.corrRT_baseline_long.itemcount); values.cutoff_RT = list.corrRT_baseline_long.item(values.index); ] </block> <block longreward_final> / preinstructions = (introreward) /trials = [ 1-10 =noreplace(AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,BX_Long_Reward, AY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward) ] </block> Thank you so much in advance! > Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&” Well, yes. You have the precue in values.precue and you need to fashon branch conditions with a logical and (&&) accordingly. Question 2 is not answerable based on the few code snippets. Are you actually populating list.corrRT_baseline_long with any latencies at all? Hi Dave, Thanks for your response. re.#1) I've been having a bit of a difficult time figuring out what the correct code is for this branch. I believe I understand that I have both the condition for when the trial is correct and the precue value, but am unsure how to specify the precue value correctly (code below) /branch = [ if(trial.AX_Long_Reward.correct && values.precue(?))trial.correctfb] re. #2) Yes, I am populating the list.corrRT_baseline_long with latencies from the trials in my “longnoreward_final” block. I have it set up as the same format as my previous trials/blocks (1&2), just named differently. Thank you so much!
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 105K
|
+x+x+x+x+x+x+xHello, My coding knowledge is rather rudimentary, so I would appreciate any help with the following questions. I was wondering if it is possible to calculate the fastest 30th percentile of correct reaction times from a baseline block, and use this new reaction time value as the cut-off reaction time in the next block? Specifically, I’m hoping to use the RT from the correct responses in my “No Reward” trials/blocks, calculate the fastest 30th percentile value, and incorporate this value as cut-off RT for the trials in my following “Reward” incentive block for each participant. In addition, is there a way to manipulate/have two different feedback messages dependent on the participant’s response? Specifically, is there a way to set it up so that if they reply accurately but slower than the RT cutoff (as determined above in the previous “No Reward” block) they receive a “Trial Over” feedback message, but if they respond incorrectly they receive an “Error” message? I currently have it set up as messages for incorrect message and correct message, but was wondering if there would be a way to make this conditional. In line with this, is there a way to change the feedback message for the correct response to also be based on the precue shown in the trial? I have attached my script for details. Thank you so much in advance! Re. 1), - put the relevant RTs in a <list> at runtime https://www.millisecond.com/support/docs/v6/html/language/functions/appenditem.htm- sort the list at the end of the baseline block https://www.millisecond.com/support/docs/v6/html/language/functions/sort.htm- then retrieve nth value from the list correponding to the 30th percentile as your cut-off and store it in a value https://www.millisecond.com/support/docs/v6/html/language/functions/item.htmRe. 2), yes, you can /branch to different feedback trials based on whether the response latency is slower than the cut-off value, etc. Hi Dave, Thank you for your reply. Could you provide a bit more clarification regarding the step about retrieving the nth value and storing it as a value? Am I creating a separate item from the list I've sorted at the end of the block? I'm just a little unclear how to adapt the code based on the link you provided. Thank you in advance! You already have a list containing the correct RTs. So then you sort it in ascending order at the end of the block, calculate the index -- 0.3 * the list's itemcount, rounded to the nearest whole number -- and retrieve the item at that index*: <block shortnoreward_final> / onblockend = [ // sort correct RTs in ascending order list.corrRT.sort(true, false); // calculate index values.index = round(0.3 * list.corrRT.itemcount); // get 30th percentile from list values.cutoff_RT = list.corrRT.item(values.index); ] / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] </block> *There's no universal definition of percentile. In some definitions the index value is taken as the percentile value. In others, it's value after that in the sorted data set, in again others, the percentile value is taken as the average of those two values, so adjust the calculatin according to your preferences. Hi Dave, Thank you so much! That makes sense. I also took your feedback and used the branch attribute to give specific feedback based on the response time or the participant’s answer. However, I have run into the following problems: 1. In addition to having the branch be conditional based on whether the participant is correct/incorrect/responds in time, I’m hoping to set it up so that the feedback presented to the participant is dependent on the “precue” that is presented on that trial. Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&”, but I’m not entirely sure. (Script below): <trial AX_Short_Reward> / inputdevice = keyboard / ontrialbegin = [ values.precue = list.precue.nextvalue; values.cue = "A"; values.probe = "X"; trial.AX_Short_Reward.insertstimulustime(shape.eraser, expressions.precueeraser); trial.AX_Short_Reward.insertstimulustime(text.cue, expressions.cue); trial.AX_Short_Reward.insertstimulustime(text.fixation, expressions.shortdelay); trial.AX_Short_Reward.insertstimulustime(text.probe, expressions.probe_short); ] / stimulustimes = [0 = precue] / ontrialend = [ values.countcorrect += trial.AX_Short_Reward.correct; values.countcorrect_AX_Short_Reward += trial.AX_Short_Reward.correct; list.ACC.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX.appenditem(trial.AX_Short_Reward.correct); list.ACC_AX_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short_Reward.appenditem(trial.AX_Short_Reward.correct); list.ACC_Short.appenditem(trial.AX_Short_Reward.correct); list.ACC_Reward.appenditem(trial.AX_Short_Reward.correct); if (trial.AX_Short_Reward.correct){ list.corrRT.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX.appenditem(trial.AX_Short_Reward.latency); list.corrRT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Reward.appenditem(trial.AX_Short_Reward.latency); list.corrRT_Short.appenditem(trial.AX_Short_Reward.latency); }; list.RT.appenditem(trial.AX_Short_Reward.latency); list.RT_AX.appenditem(trial.AX_Short_Reward.latency); list.RT_AX_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Reward.appenditem(trial.AX_Short_Reward.latency); list.RT_Short.appenditem(trial.AX_Short_Reward.latency); ] / correctresponse = ("E") / validresponse = ("E", "I") / beginresponsetime = 1800 / timeout = 1800+values.cutoff_RT / branch = [ if(trial.AX_Short_Reward.response==0)trial.tooslowfb] / branch = [ if(trial.AX_Short_Reward.error)trial.errorfb] /branch = [ if(trial.AX_Short_Reward.correct)trial.correctfb] / posttrialpause = parameters.iti </trial> <trial correctfb> /stimulustimes = [ 0=correctstim ] / validresponse = (0) / timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> <trial correct_norewardfb> /stimulustimes = [ 0=correct_norewardstim ] /validresponse = (0) /timeout = 1000 / posttrialpause = 250 /recorddata = false </trial> 2. I also created another set of blocks (“longnoreward_final” and “longreward_final”), where I hope to incorporate the same feature where the RT cut-off for the trials in “longreward_final” is the 30th percentile of the RTs from the baseline block (“longnoreward_final”). However, when I run it as the next set of blocks, the value does not seem to be properly updated, and seems to store the value used in block 2 (“shortreard_final”). Is there a way to reset/change this value? Or would I have to create a separate value to be used in block 4 (longreward_final) based on the values from block 3 (longnoreward_final)? (Script below): <block shortnoreward_final> / preinstructions = (intronoreward) / trials = [1-10 = noreplace(AX_Short_No,AX_Short_No,AX_Short_No,AX_Short_No,BX_Short_No,AY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No,BY_Short_No)] / onblockend = [list.corrRT_baseline_short.sort(false,false); values.index = round(0.3*list.corrRT_baseline_short.itemcount); values.cutoff_RT = list.corrRT_baseline_short.item(values.index); ] </block> <block shortreward_final> / preinstructions = (introreward) / trials = [1-10 = noreplace(AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,AX_Short_Reward,BX_Short_Reward, AY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward,BY_Short_Reward)] </block> <block longnoreward_final> / preinstructions = (intronoreward) /trials = [ 1-10 = noreplace(AX_Long_No,AX_Long_No,AX_Long_No,AX_Long_No,BX_Long_No, AY_Long_No, BY_Long_No, BY_Long_No, BY_Long_No,BY_Long_No,) ] / onblockend = [list.corrRT_baseline_long.sort(false,false); values.index = round(0.3*list.corrRT_baseline_long.itemcount); values.cutoff_RT = list.corrRT_baseline_long.item(values.index); ] </block> <block longreward_final> / preinstructions = (introreward) /trials = [ 1-10 =noreplace(AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,AX_Long_Reward,BX_Long_Reward, AY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward, BY_Long_Reward) ] </block> Thank you so much in advance! > Specifically, I have it set up where the “precue” is either the “$” or “■” (and then this is stored as a value). Is there a way to set it up so that if the participant answers correctly when they are presented with a “$” value, they are given the feedback in the trial “correctfb” but if they are correct and presented with a “■” they are given a different feedback message (i.e., trial “correct_norewardfb”)? Based on looking online, I believe I have to use “&&” Well, yes. You have the precue in values.precue and you need to fashon branch conditions with a logical and (&&) accordingly. Question 2 is not answerable based on the few code snippets. Are you actually populating list.corrRT_baseline_long with any latencies at all? Hi Dave, Thanks for your response. re.#1) I've been having a bit of a difficult time figuring out what the correct code is for this branch. I believe I understand that I have both the condition for when the trial is correct and the precue value, but am unsure how to specify the precue value correctly (code below) /branch = [ if(trial.AX_Long_Reward.correct && values.precue(?))trial.correctfb] re. #2) Yes, I am populating the list.corrRT_baseline_long with latencies from the trials in my “longnoreward_final” block. I have it set up as the same format as my previous trials/blocks (1&2), just named differently. Thank you so much! /branch = [ if(trial.AX_Long_Reward.correct && values.precue == "whatever the appropriate precue value here is")trial.correctfb] Re. 2), again, not answerable without the actual code.
|
|
|