oTree Forum >

Handling Excess Participants

#1 by aafsar

Hello,

I am seeking advice on managing participants admitted to an experiment when all experimental groups are already filled.

My experiment involves `num_games` groups, with each group consisting of `participant_per_game` participants who play one of the predefined repeated games. To account for potential dropouts during the previous comprehension app or while waiting to be grouped, I admit more than `num_games x participant_per_game` participants. E.g. I have 3 stage games with 20 participants each. Thus I need 30 participants for the main experiment. Considering dropouts, I admit 70 participants (10 excess) in Prolific.

After the comprehension app, participants arrive at the InitialWaitPage of the main app, game, where they are grouped by arrival time into one of the num_games groups. However, I am unsure how to handle participants who arrive after all game groups are filled.

Possible Solutions:
- Let them wait in InitialWaitpage until all excess participants arrive. But
    (I) This might make them wait unnecessarily, and
    (II) If there are dropouts in the earlier apps, this wait might not end.
- Create additional groups: Let `n_groups` to be `num_games + total_excess_participants`. Each excess participant is then placed in their own group and redirected to a secondary page designed for these participants, which then proceeds them to the final result app. In the example, this means letting `n_groups` to be `3 + 10 = 13`. Though I'm not sure if this is an efficient solution.

I would greatly appreciate your feedback on these approaches or any alternative strategies you might recommend.

Best,
Atahan

#2 by aafsar (edited )

To make (II) concrete with a minimal code example, I was considering the following method:
```python
def group_by_arrival_time_method(subsession: Subsession, waiting_players):
    if subsession.session.num_filled_groups == subsession.session.config['n_groups']:
        for p in waiting_players:
            p.excess_participant = True
            return waiting_players
    else:
        if len(waiting_players) >= C.PLAYERS_PER_GROUP:
            session.num_filled_groups += 1
            return waiting_players[:C.PLAYERS_PER_GROUP]
        else:
            return None
            
class InitialWaitPage(WaitPage):
    group_by_arrival_time = True
    template_name = 'game/MyWaitPage.html'  # @Dev: Add custom wait page

    @staticmethod
    def is_displayed(player: Player):
        return player.round_number == 1

class ExperimentFullPage(Page):
    @staticmethod
    def is_displayed(player: Player):
        return player.excess_participant
```
where
- `session.config['app_sequence'] = ['comprehension', 'game', 'result']
- `game`'s `page_sequence = [InitialWaitPage, ExperimentFullPage, PairingWaitPage, StageGamePage]`
- `session.config['n_groups']` is defined in the config (as 3, for the above example, and not as 13)
- `session.num_filled_groups` should be initialized to `0` somewhere (perhaps in the `create_session(subsession)` function of the `comprehension` app which has `NUM_ROUNDS=1`, or of the `game` app with check `subsession.round_number=1'?)
- `Player` class has an `excess_participant` field (default `False`)

Write a reply

Set forum username