#Income Dynamics, Income Sources and Preferences for Redistribution: Otree #University of Guelph, F.A.R.E Laboratory #Faculty Supervisors: Tongzhe Li and Bradley Ruffle #Programmers: Mitchell Ubene, Mark Patton, Zhelong Chen from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random import itertools import time doc = """ This is a questionare following three rounds of Income Dynamics """ class Constants(BaseConstants): name_in_url = 'Questionare' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField(label="1. What is your age?") total = models.PositiveIntegerField(initial = 0) round1_payoff = models.PositiveIntegerField(initial = 0) round1_stage = models.PositiveIntegerField(initial = 0) round2_payoff = models.PositiveIntegerField(initial = 0) round2_stage = models.PositiveIntegerField(initial = 0) round3_payoff = models.PositiveIntegerField(initial = 0) round3_stage = models.PositiveIntegerField(initial = 0) introduction_payoff = models.PositiveIntegerField(initial = 0) student = models.IntegerField( choices=[ [0, 'Yes'], [1, 'No'], ], label="2. Are you currently a student?", widget=widgets.RadioSelect) studentstudy = models.StringField(label="3. If you are currently a student, please indicate your field of study. If not leave blank:", blank=True) studentyear = models.IntegerField( choices=[ [1, '1st year undergraduate'], [2,'2nd year undergraduate'], [3,'3rd year undergraduate'], [4,'4th year undergraduate'], [5,'5th year undergraduate'], [6,'M.A'], [7,'Ph.D'], [8,'Post-doctoral student'], [9,'Does Not Apply'], ], label= "4. If you are a student, what is your year of study", widget=widgets.RadioSelect) notstudent = models.IntegerField( choices=[ [1, 'Primary School'], [2, 'High School'], [3, 'Some College/University'], [4,'Undergraduate Degree'], [5,'Graduate or Professional Degree'], [6,'Does not apply'], ], label="5. If you are not currently a student, what is your highest level of education?",widget=widgets.RadioSelect) region = models.IntegerField( choices=[ [1, 'North America'], [2, 'Central/South America'], [3, 'Africa'], [4,'Asia'], [5,'Australia/New Zealand'], [6,'Europe'], [7,'Other'], ], label="6. In what region of the world did you grow up",widget=widgets.RadioSelect) sex = models.IntegerField( choices=[ [1, 'Female'], [2, 'Male'], [3, 'Intersex'], [4, 'Choose not to respond'], # change to a text box ], label="7. What is your sex?",widget=widgets.RadioSelect) income = models.IntegerField( choices=[ [1, 'Less than $30,000'], [2, '$30,000 to $59,999'], [3, '$60,000 to $99,999'], [4, '$100,000 to $129,999'], [5, '$130,000 to $159,999'], [6,'$160,000 or more'], [7,'Do not know'] #replace with text box ], label="8. In which income bracket did your household fall into in 2020?",widget=widgets.RadioSelect) spending = models.IntegerField( choices=[ [1, '0% (none)'], [2,'Between 0% and 25% '], [3,'Between 25% and 50%'], [4,'Between 50% and 75%'], [5,'Between 75% and 100%'], [6,'100% (all)'] ], label="9. What percentage of your individual expenses is your employment income able to fund?", widget=widgets.RadioSelect) risk = models.IntegerField( choices=[ [0,'0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5,'5'], [6,'6'], [7,'7'], [8,'8'], [9,'9'], [10,'10'], ], label="10. How willing are you to take risks, in general? With 0 being not at all unwilling and 10 being very willing", widget = widgets.RadioSelectHorizontal()) leisure = models.IntegerField( choices=[ [1, 'Not at all important'], [2, 'Not very important'], [3, 'Important'], [4, 'Very important'], [5,'Extremely important'], ], label="11. How important is leisure time?",widget=widgets.RadioSelect) econview = models.IntegerField( choices=[ [1,'Very Liberal'], [2,'Liberal'], [3,'Moderate'], [4,'Conservative'], [5,'Very Conservative'], [6,'Other'], [7,'No Opinion'] ], label="11. In terms of your economic views, are you", widget=widgets.RadioSelect) political = models.IntegerField( choices=[ [1,'Very Liberal'], [2,'Liberal'], [3,'Moderate'], [4,'Conservative'], [5,'Very Conservative'], [6,'Other'], [7,'No Opinion'] ], label="12. Are you politically",widget=widgets.RadioSelect) sex14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7],label="A: A person’s sex or gender ") ability14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="B: Ability or talent that a person is born with ") group14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="C: Belonging to a particular race or ethnic group ") connection14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="D: Connections and knowing the right people ") honesty14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="E: Dishonesty and willingness to take what a person can get ") education14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="F: Getting the right education or training ") luck14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="G: Good luck ") work14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="H: Hard work and initiative ") inherited14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7],label="I: Money inherited from family ") appearance14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="J: Physical appearance ") risk14 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="K: Willingness to take risks ") sex15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7],label="A: A person’s sex or gender ") ability15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="B: Ability or talent that a person is born with ") group15 =models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="C: Belonging to a particular race or ethnic group ") connection15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="D: Connections and knowing the right people ") honesty15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="E: Dishonesty and willingness to take what a person can get ") education15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="F: Getting the right education or training ") luck15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="G: Good luck ") work15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="H: Hard work and initiative ") inherited15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7],label="I: Money inherited from family ") appearance15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="J: Physical appearance ") risk15 = models.IntegerField(widget=widgets.RadioSelectHorizontal, choices=[1,2,3,4,5,6,7], label="K: Willingness to take risks ") instructions = models.IntegerField( choices=[ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5,'5'], [6,'6'], [7,'7'] ], label="15. Please indicate how clear the instructions in the experiment were to you (where ‘1’ is very unclear and ‘7’ corresponds to very clear).",widget=widgets.RadioSelect) comments = models.LongStringField(label="16. Below is a text box in which you may enter any comments you wish about the experiment.", blank=True)