oTree Forum >

Calculate average of participant's estimate for specific rounds

#1 by Janina

Dear all,

I want to calculate the average prediction error of the participant's estimate for rounds 1 - 3.
Unfortunately, my code and all the things I tried don't work. I would appreciate if somebody has an idea how to solve this:

def before_next_page(player: Player, timeout_happened):
    player.predictionerror = abs(int(player.truevalue) - player.finalguess)
    import statistics
        if player.round_number == 3:
           player.averageestimation == statistics.mean([p.predictionerror for p in player.in_rounds(1, 3)])

Write a reply

Set forum username