Block randomization is a method of random assignment that aims to minimize the differences in sample sizes between conditions. In a study with four conditions, for example, “traditional” randomization would randomly select one of the four conditions for each participant, which may lead some conditions with more participants than others. Block randomization instead randomly selects within a “block” made up of the four conditions. Participants are still randomly assigned, but the technique ensures that a participant is selected for each condition before moving onto the next block.

The Randomization Script

Current version: 1.3 ()

I have set up a script that you may download here. Unzip the file, and place the script (“r.php”) somewhere on your artsresearch account. If you wish, you can rename this file (just be sure to keep the “.php” extension). Then open the file in a text editor like Notepad, Wordpad, or my personal favourite, Notepad++ (which should be available on school computers, and is also free to download). There are two areas to edit, and they are both near the top of the file.

The first section looks as follows: $blockRandom = true; There are two possible values for this: true or false. If set to true, the script will run with block randomization, as described above. If set to false, it will run with regular randomization, just like Bill’s script.

The second section is where you specify your conditions: $conditions = array( 'http://www.surveymonkey.com/s/THISISFAKE', 'http://www.surveymonkey.com/s/ALSOFAKE', 'http://www.surveymonkey.com/s/FAKEAGAIN', 'http://www.surveymonkey.com/s/ONEMORETIME' ); Add or delete lines as needed, but be sure to follow the same format. Each condition needs to be a link to the full URL (including the “http”), and should be within single quotation marks. Each condition should be separated by a comma (except for the last condition). If you wish to have a bit more randomization within each block, you can paste the links multiple times – just be sure to have each condition represented an equal number of times, or you will end up getting pretty lopsided sample sizes.

Final Steps

Once you’ve set up your conditions, find the URL of the “r.php” page, and that will be the URL that you give to participants. When participants click on the link, they will automatically be redirected to one of the conditions.

If you want to include participants’ Sona ID, add ?sonaid=%SURVEY_CODE% (for surveys using Bill’s script) or ?c=%SURVEY_CODE% (for SurveyMonkey surveys) to the end of the URL that you give to participants. In other words, your final URL should be something like “https://artsresearch.uwaterloo.ca/~username/study/r.php?sonaid=%SURVEY_CODE%”. Do not put it in the URLs of each condition in the script itself.

One final note: This script will generate a file named “used_conditions.txt” in the same directory that the script is in. DO NOT DELETE THIS FILE. It is used to keep track of which conditions have been used in each block. You can delete it after your study is finished running, if you wish.