from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from random import choice from random import shuffle author = 'Miguel Alberto Gomez' doc = """ Survey experiment instrument with Gregory Winger from the University of Cincinnati. """ class Constants(BaseConstants): name_in_url = 'experiment' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): # Assign treatment conditions and measure order to participants for p in self.get_players(): p.supportive = choice([True, False]) p.partner = choice([True, False]) p.state = choice([True, False]) p.initial = choice([True, False]) class Group(BaseGroup): pass class Player(BasePlayer): # Participant Consent consent = models.BooleanField() # Supportive Treatment Condition supportive = models.BooleanField() # Partner Treatment Condition partner = models.BooleanField() # State Actor Condition state = models.BooleanField() # Flag for completed experiment completed = models.BooleanField() # Browser capture, only for error testing browser = models.StringField() # Order condition for covariate measures initial = models.BooleanField() # Cooperative, Militant, Isolationist Index # isolationist 2 is reverse coded cooperative_1 = models.IntegerField(min=1, max=6) cooperative_2 = models.IntegerField(min=1, max=6) cooperative_3 = models.IntegerField(min=1, max=6) militant_1 = models.IntegerField(min=1, max=6) militant_2 = models.IntegerField(min=1, max=6) militant_3 = models.IntegerField(min=1, max=6) militant_4 = models.IntegerField(min=1, max=6) isolationist_1 = models.IntegerField(min=1, max=6) isolationist_2 = models.IntegerField(min=1, max=6) isolationist_3 = models.IntegerField(min=1, max=6) sovereign_1 = models.IntegerField(min=1, max=6) sovereign_2 = models.IntegerField(min=1, max=6) sovereign_3 = models.IntegerField(min=1, max=6) # Participant risk preference # risk = models.FloatField() # Partricipant attention attention = models.IntegerField() # Participant domain expertise knowledge_1 = models.IntegerField(min=1, max=5) knowledge_2 = models.IntegerField(min=1, max=5) knowledge_3 = models.IntegerField(min=1, max=5) knowledge_4 = models.IntegerField(min=1, max=5) knowledge_5 = models.IntegerField(min=1, max=5) knowledge_6 = models.IntegerField(min=1, max=5) # Participant Age age = models.IntegerField() # Participant Gender gender = models.IntegerField( choices=[ [1, 'Male'], [2, 'Female'], [3, 'Other'] ] ) # Participant Educational Achievement education = models.IntegerField( choices=[ [1, 'Secondary Education (High School Diploma)'], [2, 'Vocational Qualification'], [3, 'Undergraduate Degree (BA, BSc etc.)'], [4, 'Post-graduate Degree (MA, MSc etc.)'], [5, 'Doctorate (PhD, DBA etc.)'] ]) # Household Income income = models.IntegerField( choices=[ [1, 'Much Lower than the Median'], [2, 'Lower than the Median'], [3, 'A Little Lower than the Median'], [4, 'Same as the Median'], [5, 'A Little Higher than the Median'], [6, 'Higher than the Median'], [7, 'Much Higher than the Median'] ] ) # Residency resident = models.BooleanField() # Affected by Malware malware = models.BooleanField() # Dependent Variables # Self-reported Anxiety (Marteau and Bekker 1992; Spielberger 1970) # Reverse coded: 2, 3, 5 anxiety_1 = models.IntegerField(min=1, max=6) anxiety_2 = models.IntegerField(min=1, max=6) anxiety_3 = models.IntegerField(min=1, max=6) anxiety_4 = models.IntegerField(min=1, max=6) anxiety_5 = models.IntegerField(min=1, max=6) anxiety_6 = models.IntegerField(min=1, max=6) # Self-reported Anger (State-Trait Anger Expression Inventory; Spielberger 1988) anger_1 = models.IntegerField(min=1, max=6) anger_2 = models.IntegerField(min=1, max=6) anger_3 = models.IntegerField(min=1, max=6) anger_4 = models.IntegerField(min=1, max=6) # Self-reported Dread (Gomez & W Villar, 2018) dread_1 = models.IntegerField(min=1, max=6) dread_2 = models.IntegerField(min=1, max=6) dread_3 = models.IntegerField(min=1, max=6) dread_4 = models.IntegerField(min=1, max=6) dread_5 = models.IntegerField(min=1, max=6) dread_6 = models.IntegerField(min=1, max=6) dread_7 = models.IntegerField(min=1, max=6) dread_8 = models.IntegerField(min=1, max=6) dread_9 = models.IntegerField(min=1, max=6) dread_10 = models.IntegerField(min=1, max=6) # Censure actor censure = models.BooleanField() # Continue cooperation cooperate = models.BooleanField() # Continue cooperation interest = models.BooleanField() # Consequences for mediator consequences = models.BooleanField() # Responsible actor responsible = models.StringField() # State Target state_target = models.StringField() # Manipulation checks # Check for permission treatment supportive_check = models.BooleanField() # Check for partner treatment partner_check = models.BooleanField() # Check for state treatment state_check = models.BooleanField()