How to use *experiment judiciously🔗

We recommend using the *experiment keyword whenever you'd like to randomize participants to different groups while still maintaining approximately equal numbers of participants per group. For example, if you have one or more intervention groups and a control group, you will probably want to have approximately the same number of people in each group. In that case, it would be preferable to use *experiment rather than *randomize to ensure the group sizes stay as similar to each other as possible.

As explained in the manual (see this section), the *experiment keyword randomly assigns participants to a group, but in such a way as to minimize differences in group sizes. In an experiment with n groups, the first n people are randomly assigned into each of the different groups (such that each of the n groups gets exactly one of those people), then the next n people are randomly assigned, and so on. This means that for each block of n people assigned to groups, there will be one person per group. (As a consequence, if the total number of people randomized is a multiple of n, all groups will be of equal size. And if the total number of people randomized isn't a multiple of n, the largest difference in sizes between any of the two groups will be n = 1 person.)

Example of how to use the *experiment keyword:🔗

>> questionA = "How much do you care about reducing poverty?"
>> questionB = "How much money (in whole USD) are you planning to donate to effective poverty-reducing charities this year?"

	*name: questionOrder

	*group: questionAFirst
		*question: {questionA}
		*question: {questionB}

	*group: questionBFirst
		*question: {questionB}
		*question: {questionA}

This code works similarly to if you were using the *randomize keyword, except that in this case, you will only ever have a maximum difference of n = 1 between the number of participants in the two groups. (This is because every second person will be randomized to one of the two groups, and the person who next completes the program after them will be directed to the other group by default.)