Translations of this page:
 

Randomization per Block

Typically, all participants are randomly assigned to all experimental conditions (Single Factorial Design). Random assignment to experimental conditions provides the best chance that experimental groups are comparable in terms of both known and unknown predispositions within the scope of statistical selection bias.

However, statistical selection bias can lead to the experimental group not being completely independent of participant characteristics. For instance, it might occur that there are more women in the control group than in the experimental group. This becomes problematic when a participant characteristic serves as a quasi-experimental factor in the experiment.

In such cases, it can be useful to implement block randomization. This means that participants are initially divided into groups (blocks) based on a characteristic, and the assignment to experimental conditions then occurs within these blocks.

Note: Block randomization is only relevant when “sampling without replacement” ensures that all experimental conditions are drawn equally often. In SoSci Survey, “equal distribution” is the default setting for a Random Generator.

Implementation in SoSci Survey

In SoSci Survey, you use a separate random generator for each block. This ensures that selections within one block are independent of selections in other blocks.

The procedure is as follows:

• Create a random generator (Single Factorial Design).

• Ensure that the random generator performs an “equal distribution” draw—either at the time of selection (default setting)

      or an equal distribution in completed questionnaires.

• Create copies of the random generator, so you have as many random generators as blocks (question- management).

• Create a PHP filter that, based on participant characteristics (block membership), integrates

      the appropriate random generator (below: [[#include_the_random_generator|include the random generator]]).

• If you display the stimulus using PHP code (Randomization with PHP-Code),

      Copy the drawn code(s) into internal (below: [[#display_the_stimulus_per_php-code|display_the_stimulus_per_php-code]]) 
      and

• use this internal variable instead of the previous random variable.

Include the Random Generator

If you have followed the instructions for Randomization, you have always dragged and dropped the randomizer onto a questionnaire page. You do not need this step by block randomisation because here the random generator has to be integrated via show() or question().

Important: Do not place any of your random generators in the questionnaire. If you have already dragged a random generator into the questionnaire, then please remove it again from the corresponding questionnaire page under Create questionnaire.

The PHP code to include the proper randomizer follows the same basics as the IF filters presented in the Filter Questions (PHP Filters) chapter.

In the following example, the gender of a person was asked on page 2 of the questionnaire (variable “SD02”) and you want to randomize in two blocks: Men (Code 2) and the others (Answercodes 1 and 3). Therefore two random generators RG01 for men and RG02 for all others were created. The following PHP code is placed where the assignment to the trial condition is to be made, but no earlier than page 3.

if (value('SD01') == 2) {
  // Include random generator RG01 (men)
  show('RG01');
} else {
  // Include random generator RG02 (for all others)
  show('RG01');
  show('RG02');
}

Note: If the HTML code for displaying the stimulus is already stored in the random generators (single factorial design), you do not need any further PHP code and you are finished with that. If, on the other hand, you are displaying the stimulus using PHP code, please continue following these instructions.

Note: In principle, you can also divide the respondents into several blocks, e.g., by age and education, if these characteristics are relevant for the design. Please be aware, however, that more than 6 blocks are only useful for large numbers of cases. Estimate in advance the number of cases per block.

Displaying the Stimulus via PHP Code

If you are displaying the stimulus using PHP code rather than HTML code in the random generator, you have previously used the variable of the random generator for this purpose (Randomization with PHP-Code):

if (value('RG01') == 2) {
  // display text-stimulus A
  text('ST01');
} elseif (value('RG01') == 3) {
  // display text-stimulus B
  text('ST02');
}

However, now different random generators are used depending on the block. Therefore, create an internal variable in your questionnaire catalog.

Note: The “internal variables” question type allows for multiple variables per question. Therefore, a single internal variable has a longer identifier (e.g., “RG04_01”) compared to the variable of a random generator (“RG01”).

The following example assumes that the question of type “internal variables” has the identifier “RG04” and contains an item (“RG04_01”). The above PHP code for integrating the correct random generator is now complemented with PHP code that copies the drawn random number into this new variable using put().

if (value('SD01') == 2) {
  // Include random generator RG01 (men)
  show('RG01');
  put('RG04_01', value('RG01'));
} else {
  // Include random generator RG02 (all others)
  show('RG02');
  put('RG04_01', value('RG02'));
}

Regardless of which random generator was used, the drawn code is now also stored in the variable RG04_01. This variable can then be used to present the corresponding stimulus.

if (value('RG04_01') == 2) {
  // display text-stimulus A
  text('ST01');
} elseif (value('RG04_01') == 3) {
  // display text-stimulus B
  text('ST02');
}
en/create/randomization-per-block.txt · Last modified: 14.02.2024 12:59 by michaelavogel1
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki