vignettes/pkgdown/randomizer.Rmd
randomizer.Rmd
Randomly assign respondents to experimental conditions
To use the random assignment tool, select a data set where each row in the data set is unique (i.e., no duplicates). A dataset that fits these requirements is bundled with Radiant and is available through the Data > Manage tab (i.e., choose Examples
from the Load data of type
drop-down and press Load
). Select rndnames
from the Datasets
dropdown.
Names
is a unique identifier in this dataset. If we select this variable and specify two (or more) Conditions
(e.g., “test” and “control”) a table will be shown with a columns .conditions
that indicates to which condition each person was (randomly) assigned.
By default, the Random assignment
tool will use equal probabilities for each condition. However, as can be seen in the screenshot below, it is also possible to specify the probabilities to use in assignment (e.g., 30% to “test” and 70% to the “control” condition).
If we expect that some variables are likely predictive of the outcome of our experiment then we can use blocking
to decrease sampling variability. In block random assignment (or stratified random assignment) subjects are first sorted into blocks (or strata) based on one or more characteristics before being randomly assigned within each block. For example, if we select Gender
as a Blocking variable
the Random assignment
tool will attempt to put exactly 30% of men and exactly 30% of women in the treatment condition based on the Probabilities
we specified in advance. As we can see in the screenshot below, the assignment of men and women to the test and control condition turned out exactly as intended.
By default, the random seed is set to 1234
to ensure the sampling results are reproducible. If there is no input in Rnd. seed
, the selected rows will change every time we generate a sample.
To download data with the assignments in the .conditions
column in CSV format, click on the icon in the top-right of your screen. The same data can also be stored in Radiant by providing a name for the dataset and then clicking on the Store
button.
Add code to Report > Rmd to (re)create the sample by clicking the icon on the bottom left of your screen or by pressing ALT-enter
on your keyboard.
For an overview of related R-functions used by Radiant for sampling and sample size calculations see Design > Sample
For more information see the vignette for the randomizr
package that radiant uses for the Random assignment
tool.
The key functions from the randomizr
package used in the randomizer
tool are complete_ra
and block_ra
.