Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

feedback

Dear all

For my experiment I created a stop signal task and the participants receive a feedback after every block. This feedback is an overview that shows them their results of the current block and their results of the preceding block as a comparison (accuracy and reaction time). For the reaction time I only want to include the correct go trials (incorrect trials and stop trials should not be included). For this reason I created this code:

 
var.accuracy_block1 = var.accuracy

if var.stop_signal == 1 and var.correct == 1: #stop_signal == 1 -> 0 = stop trial; 1 = go trial
    var.total_responses += 1
    var.total_response_time += var.response_time
    var.reaction_block1 = var.total_response_time/var.total_responses

Somehow this code doesn't work - although I specified

 if var.stop_signal == 1 and var.correct == 1: 

it still counts every response time and every response (no matter if the answer was correct or incorrect and whether it was a go or a stop trial). Did I overlook something?

As I mentioned above I want to show the participants an overview and a comparison between the successive blocks. I created this code:

 
var.difference_accuracy_block2 = abs(var.accuracy_block2 - var.accuracy_block1)

var.difference_reaction_block2 = abs(var.reaction_block2 - var.reaction_block1)

if var.accuracy_block2 < var.accuracy_block1: 
    exp.acc_performance = acc_schl
else:
    exp.acc_performance = acc_bes

if var.accuracy_block2 == var.accuracy_block1:  
    exp.acc_performance = acc_gl

if var.reaction_block2 < var.reaction_block1:
    exp.rt_performance = rt_schn
else:
    exp.rt_performance = rt_langs

if var.reaction_block2 == var.reaction_block1:
    exp.rt_performance = rt_gl

The two codes I posted above are connected. The first code calculates the reaction time and the second code compares the successive blocks which results in a costumized feedback. When the first trial of a block starts with a stop signal I get an error messages stating that there is no reaction_block. In the first code I only define what should happen if the variable "stop_signal" = 1 and the answer is correct. Could it be that I get the error message when the first trial of a block starts with a stop signal because there is no result yet (i.e. 0) so the program can't calculate anything?

Thanks for your help!
Cheers

Comments

  • Hi

    Could you attach your code, would make it easier. Also what does the error message say.

    Gary

  • Dear Gary

    Thanks for your answer. I actually attached the codes I'm using (3 different codes), are they not visible? Or do you mean something else? The error message says: "The variable 'reaction_block2' does not exist".

    Cheers

  • Hi

    I meant the whole experiment.

  • Hi Zsc,

    Seeing the experiment would definitely help. Just because there are not information around to know what the problem is. If I had to take a guess, I would say, something is happening with the prepare/run phase of your code. But again, without the entire code, we can't really help.

    Eduard

    Buy Me A Coffee

  • Dear Eduard, dear Gary

    Thanks for your answer. I attached my experiment, it is a little bit chaotic because this version is only temporary. As I mentioned above I'm trying to give the participants a costumized feedback. The feedback should only include correct answers in the go trials (i.e. without stop trials or incorrect trials). You will see that the results in the excel file include all trials (even though I specified in my code that it should only add the correct go trials). This problem occurs in all 4 blocks (experiment_loop_SSTF_block1, experiment_loop_SSTF_block2, experiment_loop_SSTF_block3, experiment_loop_SSTF_block4).

    The second problem occurs in experiment_loop_SSTF_block2, experiment_loop_SSTF_block3 and experiment_loop_SSTF_block4. When the first trial of a block starts with a stop signal I get an error message stating that there is no reaction_block.
    I hope I managed to explain my problem, if not please do ask!

    Cheers
    Zsc

  • Hi Zsc,

    First of all, in your code you do things like clock = timer2clock(timer), even though syntactically correct, that is sort of a problem, as you are overwriting one of Opensesame's functions (i.e. clock.time(), clock.sleep). If you don't use them, it shouldn't matter, but still I'd recommend, giving your clock a different name.

    The second problem occurs in experiment_loop_SSTF_block2, experiment_loop_SSTF_block3 and experiment_loop_SSTF_block4. When the first trial of a block starts with a stop signal I get an error message stating that there is no reaction_block.

    This problem is because you always run the feedback inline_script in which you take the difference betweent he response times of block 2 and block 1, but you only define the response_time of block 2, on stop trials. Therefore, if the first trial is a go trial, the experiment crashes. Makes sense?

    TO fix it, you either need to initiliaze a your var.reaction_block2 earlier, or you run the feedback script, only contingent on whether or not a stop trial occurred (preferred option).

    You will see that the results in the excel file include all trials (even though I specified in my code that it should only add the correct go trials).

    That problem occurs due to 2 reasons. One, you use a variable that Opensesame is also using in the background (var.total_responses), so that even though you do not increment it on every trial, Opensesame does, so that your average response times, change on a trial basis (btw. that's a similar problem as I mentioned above, with the clock). Just use a different variable name and you are set. Second, you reset the variable on every trial to be 0 again (in the prepare phase of results_block1), which does not make much sense. What you want is resetting it to 0 once, before the block starts, but then keep on incrementing it without resetting it in the loop itself.

    I attach your experiment, where the issue of block 1 should be fixed. The later issues, I haven't implemented as that depends a little more on how you want your experiment to behave, and it is also not very difficult to do.

    Good luck,

    Eduard

    Buy Me A Coffee

  • Dear Eduard

    Thank you so much for your help!!
    I didn't know that the variable var.total_responses already exists so that makes totally sense! And it was a stupid mistake that I reset the variable on every trial to be 0 again (I tried to integrate everything into 1 inline script :)).
    Just to be sure that I understand your solution for my second problem: for the feedback inline script I defined run if [stop_signal]= 1 in the trial sequence (stop_signal = 1 means that there is no stop signal) and it seems to work (it doesn't show the error message anymore if the first trial is a stop trial). Is that what you meant?

    Again, thanks for your help!
    Cheers

  • I suppose. It sounds reasonable at least. But test your script and check your data before you start collecting. You were absolutely right when you said your script is a little messy ;-). I would not be surprised if some variables change in ways in which you don't intend them to change.

    Good luck,

    Eduard

    Buy Me A Coffee

  • Great, thanks! Yes, I will definitely check everything before I start collecting data :)

    Cheers
    Zsc

Sign In or Register to comment.