psychopy.org | Reference | Downloads | Github

Increasing chance of outcome with each incorrect response

Hey,

Let me try and explain what I need without confusing anyone!

I’m trying to design a kind of risk taking task and participants need to press ‘Q’ to try and get the point for that round. Trick is, ‘Q’ only has a 20% chance of getting them the point with each press. I’ve got this working.

Now, what I would like to happen is that each time they press ‘Q’ and fail, for there to be a chance that they LOSE a point. Ideally, with each incorrect key press, this percentage increases (10%, 20%, 30%…etc).

Any suggestions on how I could make that happen?

Cheers

CK

It seems like you’ve probably mostly solved this problem with your first step. i.e. there you presumably generate a random number and compare it against a fixed threshold of 0.2. If less than that, they get a point, otherwise not.

To apply the second constraint, instead of a fixed threshold, you simply compare against a variable one, which moves up in increments of 0.1 to a ceiling of 1.0 for each incorrect response.

Thanks for the reply Michael,

Actually my first step isn’t nearly as graceful haha - I’ve got a loop on fullRandom pulling from a conditions file with 5 conditions and only one has the correct response, hence the 1/5 or 20% chance of success. Your way sounds much better - how would I go about that?

Cheers

Not necessarily: there are many ways to use randomisation, with advantages and disadvantages. The advantage of your scheme is that the order is fully random across subjects but you retain a balancing of events across any other design factors and can be sure that the proportion of events is exactly 0.2 for every subject. Using a random number on every trial doesn’t satisfy that, as there will be sampling variability across subjects (for some the proportion might be 0.18, for others 0.23, etc) and events will not be exactly balanced across any other factors in your design.

You need to use some custom code to keep track of both the score and the current value of the risk of losing a point. I’m going to assume that you have defined a “correct answer” column in your conditions column which is 'q' on 20% of trials and empty on the other trials, and that therefore the keyboard component will record a correct or incorrect value on each trial accordingly (i.e. I suggest you stick with your current arrangement of a fixed proportion of 20% of trials unless there is a good reason to change).

So insert a code component from the “custom” component panel. In its “begin routine” tab, put something like this:

# only on the first trial, initialise these values:
if your_loop_name.thisN == 0:
    score = 0
    loss_threshold = 0.0

And in the “end routine” tab:

if your_keyboard_component_name.corr:
    score = score + 1
else:
    # increment loss threshold, to a maximum of 1.0:
    loss_threshold = min(loss_threshold + 0.1, 1.0)

    # compare against a sample from a uniform distribution of (0.0, 1.0]:
    if random() < loss_threshold:
        score = score -1

# save in the data for this trial:
thisExp.addData('score', score) 
thisExp.addData('loss_threshold', loss_threshold)