Condition assignment

How DataPipe assigns participants to conditions, and what it deliberately does not do.

How many conditions

DataPipe hands each participant the next number in a fixed sequence: 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 DataPipe experiment is created with one condition, and with one condition every participant is handed 0 and nothing ever advances. The dashboard field will not go below 2, so a study with multiple conditions requires you to type the number in.

Underneath, 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 — and it does both inside one transaction, so two participants who ask at the same moment always get different numbers rather than the same one twice.

Nothing resets the counter. Turning condition assignment off and on again picks up exactly where it left off, and so does changing the number of conditions: if you lower n mid-study, the next participant can receive 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. 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 consumed that number; the sequence moves on regardless. Over a study with dropouts, your cells will not 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. Save that number into the data you send if you want to know which condition a participant was in.

Factorial designs

If your design has multiple factors, set n to the total number of unique cells and map each number to the appropriate factor levels in your experiment code.

A 2 × 3 design is 6 conditions: request a number, then divide and take the remainder to recover each factor — for example Math.floor(condition / 3) for the two-level factor and condition % 3 for the three-level one.

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

Created by the developers of jsPsych ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Test environment. Data sent here is not preserved. Do not sign in with production credentials.