Condition assignment

How DataPipe assigns participants to conditions, and what it leaves for you to handle.

How many conditions

DataPipe gives each participant the next number in a fixed sequence from 0 to nāˆ’1, where n is the number of conditions you set. With 3 conditions, the sequence is 0, 1, 2, 0, 1, 2, and so on.

Set the number when you turn the switch on. A new experiment starts with one condition, and with one condition every participant gets 0 and the sequence never advances. The dashboard field won't go below 2, so for a multi-condition study you need to type the number in.

Behind the scenes, DataPipe keeps a single counter on the experiment. Each request returns the counter's current value and then advances it, wrapping back to 0 after nāˆ’1. Both steps happen in one transaction, so two participants who ask at the same moment always get different numbers.

Nothing resets the counter. Turning condition assignment off and on again picks up where it left off, and so does changing the number of conditions. If you lower n mid-study, the next participant may get a number that is now out of range, and the one after that starts again at 0. Change n before you recruit, not during.

The code samples include a ready-made condition request for jsPsych and for plain JavaScript. It throws on failure rather than returning a value, so a participant is never quietly started on the wrong timeline. Sending data from your experiment

What it is not

  • It is not random assignment. The order is fixed and predictable. If your design needs randomization, randomize in your own experiment code and leave this switch off.
  • It does not re-balance. A participant who requests a condition and then closes the tab has still used up that number. The sequence moves on regardless. Over a study with dropouts, your cells won't end up exactly equal, so check the counts in your data rather than assuming them.
  • It is not tied to data collection. Condition requests are answered whether or not the experiment is accepting data, and even after an experiment has been finalized. The only thing that stops them is switching condition assignment off, after which requests are refused with CONDITION_ASSIGNMENT_NOT_ACTIVE.
  • It is not recorded with each participant's data. DataPipe hands your experiment a number and forgets it. If you want to know which condition a participant was in, save that number into the data you send.

Factorial designs

If your design has more than one factor, set n to the total number of cells and map each number to a combination of factor levels in your experiment code.

A 2 Ɨ 3 design has 6 conditions. Request a number, then use division and the remainder to recover each factor: Math.floor(condition / 3) gives the two-level factor and condition % 3 gives the three-level one.

Because assignment is sequential, a factorial mapping stays balanced across every complete run of n participants. That balance is the main reason to prefer it over randomizing in your own code.