Howdy, Stranger!

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

Supported by

Possible? correct_response dependent on cumulative response

Hi there,

In my probability guessing experiment I show a pre-set sequence of 100 trials of blue and orange squares. The subject has to guess whether the next colour will be blue or orange. Feedback sound is given when the guess was incorrect.

The correct_response is dependent on the cumulative proportion of the responses compared to the cumulative proportion of the given sequence. e.g. when at trial 10 the cumulative proportion of the given sequence of blue is 0.7 and orange is 0.3, then the answer is correct when the cumulative proportion of the responses lies in between 0.8 and 0.6 for the blue colour.

Is it possible to make the correct_response dependent on the response given up until that trial in a block sequence? See image for what that could look like in python(Jupyter).

Thank you very much in advance!

Zoë


Comments

  • Hi Zoe,

    Yes that is possible. You can define whatever the correct response should be. For example, a response has been given, you can set the correct response like this:

    if var.response >= 0.6 and var.response <= 0.8:
        var.correct = 1
    else:
        var.correct = 0
    

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Thank you very much for your quick reaction!

    The response options are 1 for blue and 0 for orange. What has to be in between 0.6 and 0.8 is the cumulative proportion of the responses that have been given up until the current trial.

    Do you maybe also know how I can access the list of responses within a block after every trial?

    e.g. After nine trials:

    responses given: [0,1,1,1,0,1,1,0,1]

    cumulative responses: [0.0, 0.5, 0.66, 0.75, 0.6, 0.66, 0.71, 0.63, 0.66]

  • Hi,

    Opensesame keeps track of all the responses in the responses object. See here for the documentation:



    eduard

    Buy Me A Coffee

  • edited May 2020

    Hi Eduard,

    Thank you. It helps, but still the execution is rather difficult. I made the code below, but I am not sure if the function is able to access the response history now. The debug window says that responses is not defined. Do you have an idea what is going wrong here?

    Then, when I have this working in python. I will have to translate it to JavaScript, to be able to distribute online.


  • Do you happen to have put the code in the prepare phase? Otherwise, can you share the experiment?


    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Yes I did put the code in the prepare phase.

    The experiment is attached :)


  • Then try putting it in the run phase (sorry should have mentioned that earlier)

    Buy Me A Coffee

  • unfortunately that gives the same error message

  • I think the responses object is only available if you have given at least one response. Therefore, checking it in the beginning of the experiment when you have collected any responses yet, won't work. Try to insert the code in the end of a block or somewhere later in the experiment. Then you will get more informative error messages I suppose

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.