Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
en:create:functions:random [10.04.2016 10:17] – [random()] admin | en:create:functions:random [10.04.2016 10:20] – [Drawing with Replacement] admin |
---|
**Note:** If a random draw without replacement is used in an experiment, then different sizes of experimental groups are inevitable. SoSci Survey offers [[:en:create:random_urns|urns]] for random draws with replacement. | **Note:** If a random draw without replacement is used in an experiment, then different sizes of experimental groups are inevitable. SoSci Survey offers [[:en:create:random_urns|urns]] for random draws with replacement. |
| |
**Note:** See [[:en:create:randomization]] for the application of random draws. | **Note:** See [[:en:create:randomization]] for the application of random draws. |
| |
| |
The PHP functions ''[[:en:create:functions:random|random()]]'' and ''[[:en:create:functions:random_p|random_p()]]'' (for weighted random draws) randomly draw with replacement. An unrestricted random draw "with replacement" is comparable to throwing a die. As a rule, group sizes vary greatly here and this can be problematic for the analysis. | The PHP functions ''[[:en:create:functions:random|random()]]'' and ''[[:en:create:functions:random_p|random_p()]]'' (for weighted random draws) randomly draw with replacement. An unrestricted random draw "with replacement" is comparable to throwing a die. As a rule, group sizes vary greatly here and this can be problematic for the analysis. |
| |
**Note:** When drawing with replacement, it is crucial to ensure that the random number is saved in the data record. To do this, use an [[:en:create:questions:internal|internal variable]] and the function ''[[:de:create:functions:put|put()]]''. | **Note:** When drawing with replacement, it is crucial to ensure that the random number is saved in the data record. To do this, use an [[:en:create:questions:internal|internal variable]] and the function ''[[:en:create:functions:put|put()]]''. |
| |
- Add a new question in the **List of Questions** using the type "Internal Variables" (e.g. with ID ''IV01'') | - Add a new question in the **List of Questions** using the type "Internal Variables" (e.g. with ID ''IV01'') |
- Add a variable (item) in this question with the description, as an example, "random number". According to the **Variables List**, this variable's ID is ''IV01_01''. | - Add a variable (item) in this question with the description, as an example, "random number". According to the **Variables List**, this variable's ID is ''IV01_01''. |
- [[php|PHP code]] is used to carry out the actual random draw. | - [[:en:create:php|PHP code]] is used to carry out the actual random draw. |
| |
<code php> | <code php> |