oTree Forum >

Beginner - Assigning probabilities to each round of a task randomly and without replacement

#1 by taboulet (edited )

Hello, 

I am a master's student who has recently begun using otree to program experiments. I am currently designing an "outcome scaled" MPL task as follows: 

For each phase, options A and B will be presented side by side and will be allocated randomly to either the lottery or the safe amount. While the lottery will remain fixed in each row, the value of the safe option increases from row-to-row in 1€ steps. The subjects express their preference by clicking on each option they prefer for each row, and the unique switching point from option A to B will express their certainty equivalent. Regarding the nature of the lotteries, for the purpose of simplicity, we will focus on 5 lotteries employed by Oprea (2024) to replicate the fourfold pattern of risk attitudes. Lotteries pay a gain of 20€ with probabilities p ∈ {0.1, 0.25, 0.5, 0.75, 0.9} and 0€ otherwise. Note that the order in which the gain lotteries appear will be random. In addition, participants will have to complete a consistency task to ensure consistent responses. More specifically, this consistency task will be based on one of the 5 tasks presented above.

To implement this, I adapted the app designed by Felix Holzmeister for the HL MPL (2002), which I adapted to fit the desired design. However, I have been struggling for a week to randomly assign a probability to each configuration of my task (e.g., (20, 0.9; 0, 0.1) for the option A in the first task; (20, 0.25; 0, 0.75) for the option A in the second task; etc.). I tried a lot of stuff (a task index; creating 100 choices that I would break down in 5 in the decision.html, ...), but I finally decided to randomly assign without replacement a specific probability to each round. Nevertheless, it doesn't seem to work (it seems I am overwritting my variables for each round and only the last one is retained). I would greatly appreciate any advice from experts on which direction I should take, as I am running out of ideas. I am including the python code if someone wants to have a look, but I can add the html files if needed.
Please consider that I started using oTree only a week ago when providing your guidance.

Thanks in advance !!!

#2 by taboulet

Problem fixed !

Write a reply

Set forum username