psychopy.org | Reference | Downloads | Github

Drifting Probability of Correct Answer Within Blocks

Hi - I am running 1.84.2 on a Mac. I previously posted a while back but am now a little clearer on what I am trying to achieve … although after weeks of banging head against a wall I am not certain this can be done in the coder view. I am also not terribly savvy at any of this so I apologize in advance…

I am working on a reinforcement learning paradigm. Essentially the subject will select between image X or Y --> the outcome = win or lose. X and Y need to be randomly assigned to the left or the right of the screen (so cannot assign outcome to position). I have been able to make the probability of each stimulus fixed within a block and alternating between blocks but am unable to make it drift within the block. Is anyone familiar with this?

Thank you in advance.

It’s definitely possible in code. I’m not sure what aspect you’re struggling with.

You could have a value called currentProb which is a value from 0:1 and can vary smoothly during your trials. Is that the piece you don’t know how to do? How are you wanting the “drift” to occur? You could just increment the value on each trial to make it gradually more likely:

currentProb = currentProb+0.01

I’m stuck because I’m solely using the builder … likely my problem? For example: in one block, shape 1 will have a 60% prob of being correct on first trial, 61%, 62% and so forth. Does that make sense? The code you gave above makes sense - I’m just not sure where that would go.

You’d need to put it in a code component in the “Begin Routine” section. You also need something to use that probability to adjust your stimulus accordingly, like:

currentProb = currentProb+0.01
if random()>currentProb:
    xStim.pos = (200,0)
    yStim.pos = (-200, 0)
else:
    xStim.pos = (-200,0)
    yStim.pos = (200, 0)

Oh and in the Begin Experiment section you need create your initial value for the currentProb:

currentProb = 0.6

I’d also recommend that you consider the workshop on Building Experiments with PsychoPy where you’ll learn a lot more about how to build studies effectively. There’s a limit to how much individual support we can provide here.

Thank you so much Jon - hugely appreciated! Will keep an eye out for courses Stateside.