Randomise within groups

50 views
Skip to first unread message

Joe Green

unread,
Dec 3, 2021, 4:17:57 PM12/3/21
to ot...@googlegroups.com
Hi all,

I have a study where two groups will be playing parallel public goods games at the same time. I want to be able to randomise it so that one player in each group gets more in their endowment than the rest of the players.

At present, it seems like I can either have it as a fixed effect where, say, every 3rd person in the group gets the larger endowment. Or, that we randomise it so that any player has a 1 in whatever chance of getting the bonus. Neither of these satisfy what I’m looking for. So my question is: is there a way to ensure that one player in each group gets a larger endowment, but that the order of who gets this is randomised within each group?

Thanks in advance,
Joe

Chris @ oTree

unread,
Dec 3, 2021, 4:53:03 PM12/3/21
to oTree help & discussion
def creating_session(subsession):
  for g in subsession.get_groups():
    players = g.get_players()
    for p in players:
      p.endowment = 100
    rich_player = random.choice(players)
    rich_player.endowment = 200

Reply all
Reply to author
Forward
0 new messages