Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:create:randomization [06.06.2017 13:14] – update adminen:create:randomization [19.12.2018 11:05] – [Urns for Subgroup I] freekgille
Line 6: Line 6:
  
 Tip: Read the chapters [[php|Introduction to PHP]] and [[array|Introduction to Arrays]] for a better understanding of the complex example codes shown below. Tip: Read the chapters [[php|Introduction to PHP]] and [[array|Introduction to Arrays]] for a better understanding of the complex example codes shown below.
 +
 +
 +===== General Usage =====
 +
 +The experimental logic (between-subject) assumes that the participants of an experiment are divided into experimental groups. Depending on the group assignment, a question, text, image or video (the treatment or stimulus) is then varied.
 +
 +Even if your goal "only" is that, for example, half of the participants should answer question A and the other half of the participants should answer question B: Please remember that conceptually a division into experimental groups takes place.
 +
 +
 +==== Step 1: Assignment to experimental groups ====
 +
 +Create a question of type [[:en:create:questions:random]]. In the field //Codes (contents)// write a short description of your experimental groups, e.g.
 +
 +<code>
 +Control Group
 +Positive Exemplars
 +Negative Exemplars
 +</code>
 +
 +After saving, SoSci Survey adds a numeric code for each group, e.g.
 +
 +<code>
 +1 = Control Group
 +2 = Positive Exemplars
 +3 = Negative Exemplars
 +</code>
 +
 +With the //Type of drawing// you can decide whether you want to select "Equal distribution in completed questionnaires" instead of "Equally distributed" draw. This can be useful if you expect systematically more drop-outs in an experimental group.
 +
 +For //Codes drawn per interview// leave the value 1. Thus, the participant is only assigned to one of the experimental conditions/groups. The drawing of several codes is useful for certain within-subject designs.
 +
 +
 +==== Step 2: Presentation of the Stimulus ====
 +
 +In **Combine Questionnaire**, drag the newsly created random generator question onto the page in the questionnaire where you want the participant to be assigned to an experimental group. Usually this is the page where the stimulus is presented.
 +
 +The random generator will now randomly draw one of the defined groups and store its code in a variable with the random generator's ID. For example, if the random generator question has the ID "RG01", the number drawn would be stored in the data set as variable "RG01". In the above example, code 1, 2 or 3 would be stored.
 +
 +Place an element "PHP-Code" ([[:en:create:php]]) where you want the stimulus to appear (in any case under the random number generator question or on a later page). Here you need the PHP code for a [[:de:create:filters|PHP filter]], which displays the appropriate stimulus depending on the assigned experimental group (=drawn random number).
 +
 +If the stimulus is a question (i.e. in group A another question from the **List of Questions** is to be displayed than in group B), the function ''[[:de:create:functions:question]]'' is used. For texts, images and videos use the function ''[[:de:create:functions:text]]'', that integrates the HTML code to display the corresponding stimulus from a text module. More about this below and under [[:en:create:images]] and [[:en:create:media]].
 +
 +The following PHP code would display the question "AB01" in the group "Positive Exemplars", the question "AB02" in the group "Negative Exemplars" and nothing at all in the control group.
 +
 +<code php>
 +if (value('RG01') == 2) {
 +  question('AB01');
 +} elseif (value('RG01') == 3) {
 +  question('AB02');
 +} else {
 +  // You may omit the else part,
 +  // nothing happens here
 +}
 +</code>
 +
 +The function ''[[:en:create:functions:value]]'' is responsible for reading the random number drawn from the variable "RG01" (this ID may have to be replaced by the ID of the random generator!) and making it available in the PHP code for the filter.
 +
 +The other sections of this manual explain various areas of application of randomization.
 +
  
 ===== Drawing of a Random Number ===== ===== Drawing of a Random Number =====
Line 513: Line 572:
 It may be the case that you need to ensure equal distribution of experimental groups in two subgroups -- for instance, if you have 3 stimuli and both the women in the study, as well as the men, should be equally divided between all three conditions. It may be the case that you need to ensure equal distribution of experimental groups in two subgroups -- for instance, if you have 3 stimuli and both the women in the study, as well as the men, should be equally divided between all three conditions.
  
-To do so, you require an internal variable and two urns (with the same content). The following example assumes that the sex was queried on an earlier page in the multiple-choice question SD02. Also, that you have set up two urns with the IDS "women" and "men", both of which contain the numbers 1 to (each one on a separate line).+To do so, you require an internal variable and two urns (with the same content). The following example assumes that the sex was queried on an earlier page in the multiple-choice question SD02. Also, that you have set up two urns with the IDS "women" and "men", both of which contain the numbers 1 to (each one on a separate line).
  
 <code php> <code php>
en/create/randomization.txt · Last modified: 20.04.2021 20:33 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki