# Trial Randomization

## Description

While the trial system details how many trials (trial variations) there are defined in total, the trial randomization menu regulates how many trials are seen by each subject and how these are selected and ordered. "Trial selection" and "trial ordering" are two different consecutive processes. The trial randomization settings are located in the task editor in the left panel under "Randomization". Click on "Edit" to open the settings dialog, in which all relevant settings can be adjusted. The complete randomization settings consist of 6 separate menus. The "Trial Order" menu and the "Condition Order" menu are used to determine the overall trial order, while the menus "Factor Randomization", "Trial Per Subject", and "Resulting Condition Groups & Trials" are used to for trial selection. "Simulation of Trial Sequence" is used to preview the randomization settings that have been applied.

## Trial Order

The trial order is the main setting, which will influence how trials are ordered /randomized. There are 5 possible settings:

- Random (default option): When this option is selected, the Labvanced randomization settings will be most adjustable. The core feature of this option is that all selected trials will be randomly reshuffled for each new subject / session. If there is more than one trialgroup, the trials of different trialgroups will be presented intermixed.
- Fixed by Design: If this option is selected, the trials will be presented in the order of how they are defined in the task editor (lower trial numbers will be shown first). This order will be the same for all subjects.
- Fixed by Hand: If this option is activated, users can type a self-selected trial sequence. The sequence should be typed in the box "Specify Fixed Trial Sequence". To type in the sequence, use the trial numbers as defined in the editor and separate each number by a comma. This sequence will be the same for all subjects. As this option will specify both which trials are shown as well as the order of trials, the settings in other randomization menus will be ignored in this case.
- Dynamic: This option can be used to create adaptive / dynamic trial sequences (e.g. jump to different trials based on the answer of the participant). Select a start trial number and then use the event system "Jump to specific trial" for deciding on the dynamic trial sequence.
- Upload Trial Sequences: If you select this option, you can specify an individual trial sequence for each subject using an external CSV file (trials separated by comma, subjects by a newline CR-LF). Then upload these sequences and and select how you want to count the subjects (have a separate counter for each subject group, or use a global subject counter).

## Condition Order

The Condition Order menu also influences the order of trials. This option determines whether the individual conditions are presented in a block-wise order, or randomly intermixed (Random).

The "Random" option will show all trials of the various conditions in an intermixed way. To further enforce "randomness," the number of trials shown from the same condition can be limited. Choose the Randomization constraint "Limit Successive Repetitions" and type in the maximum number of repeating conditions.

The "Blockwise" option will separate the trials, such that first trials from one condition will be shown, then another condition, and so on. The order of the conditions can be either based on the design in the trial editor (fixed by design), or it can be randomly reshuffled (unbalanced permutation).

## Factor Randomization

The Factor Randomization settings determine which trials will be seen by a subject. The most important setting here is whether a factor will be fixed or random. While "fixed factors" will generate more trials for a subject (all levels of a fixed factors will be shown), "random factors" will increase the "trial variations" from which only one version will be selected (only one of the levels of a random factor is shown). Depending how these trial variations are chosen (settings within random factor), random factors allow for within and / or between subject balancing. Overall, there are 5 possibilities for how the random factors select a level and thereby choose a certain trial variation. These 5 options are listed below:

- Unbalanced within task: For each trial, the level of the random factor is chosen randomly every time from all available options (levels).
- Balanced within task: For each trial, the level of the random factor is chosen such that each level will occur equally often within the whole task.
- Balanced within other Factors: This balances one factor within another or within several other factors. If, for instance, the factor "position" is balanced within the factor "image content", then for each level of the factor "image content" the factor position is balanced (e.g. level=left and level=right appear equally often in both cases image=face and image=house). A factor can also be balanced within several other factors, however, no circular dependencies may arise.
- Unbalanced between subjects: The level of the random factor will be always the same for one subject / execution of the task, but randomly vary between subjects / executions of the task.
- Balanced between subjects: The level of the random factor will be always the same for one subject / execution of the task, but systematically vary in between subjects / executions of the task. As a result, when the factor has 3 levels, subject 1 will see level_1 of the factor, subject 2 level_2 of the factor, and subject 3 level 3 of the factor. Subject 4 will see again level_1 of the factor, and so on repeating the pattern.

A further important concept is the "condition group". The condition groups are calculated by crossing all of the fixed factors within a trial group, excluding the random factors. As a result, one condition group consists of several conditions (and trials), which vary only in their levels of random factors. Many times, the trials within the individual conditions of a condition group are almost identical (e.g. they show the same stimuli but vary in their position). Many times it is important to prohibit that 2 almost identical trials are selected. To change these settings, in the Factor Randomization section, users can change how the trials are selected within condition groups. Here, two options are available:

- Balanced within each condition group: Trials which vary only by one or more random factors cannot be chosen more than once.
- Unbalanced within each condition group: There is no restriction on the trial selection process within condition groups.

We believe that for the vast majority of cases the "Balanced within each condition group" option is the best choice.

### Example

As the factor randomization (trial selection) process can be quite complex to understand, let us look at an example. In this example task, subjects will see 2 images: one which they have seen before (target), the other one is unfamiliar (distractor).The task is to click on (identify) the target stimulus. Overall there are 4 factors: 1 fixed factor and 3 random factors:

- Fixed Factor "Presentation Time / Difficulty": This factor has 3 levels, 2 seconds (hard), 4 seconds (medium), and 6 seconds (easy). Each condition should be presented 20 times.
- Random Factor "Position of Correct": This factor has 2 levels, target image is left, and target image is right. Overall, there should be the same amount of "left correct answers" and "right correct answers" to avoid any bias.
- Random Factor: "Image Orientation": This factor has two levels: horizontal, and upsideDown (images are rotated 180°). This factor should be balanced within the fixed factor "Presentation Time" to insure that for each difficulty level there are equally many trials rotated and normal.
- Random Factor "Image Category": This factor has 3 levels: houses, cars, and faces. This factor will be used to generalize the findings. Each subject should only see one category / type, but this factor should be balanced across subjects.

#### Settings

**Presentation Time --> Fixed Factor**As this is the only fixed factor, there are only 3 condition groups (easy, medium, hard). Each condition group has 12 sub-conditions, with each 20 trials inside. 60 trials will be presented in total to each subject.**Position of Correct --> Random Factor --> Balanced Within Task**The factor "Position of Correct" will be set to "balanced within task". This way, the target image will appear equally often in the left and the right position in the overall task. However, this is not balanced within each condition / presentation time (difficulty level).**Image Orientation --> Random Factor --> Balanced within other factors --> "Presentation Time"**The factor "Image Orientation" will be set to "Balanced within other factors," then the factor "Presentation Time" is selected. This way, for each of the 3 levels of the factor "Presentation Time," there will be an equal amount (10) of images that are presented normally and images that are presented upside down (10).**Image Category --> Random Factor --> Balanced between Subjects**The factor "Image Category" will be set to "Balanced between subjects. This way, each subject will only see one image category (houses, cars, OR faces), but the category selection will be balanced across subjects (Subject 1 will be houses, subject 2 cars, subject 3 faces, subject 4 houses, and so on).

## Resulting Condition Groups and Trials

The displayed information at the "Resulting Condition-Groups & Trials" menu is strongly dependent on the settings in the "Factor Randomization" menu. Mainly, this menu will show a table of the condition groups, together with some additional information. There are 2 additional settings which influence the trial selection process:

- Nr trials to show per condition group: This option will influence how many trials are shown per condition group. This setting is only important if the number of trials should be different within one condition group (between conditions) than another. In general, the number of trials per condition group will be based on the condition which has the fewest number of trials defined. For instance, if there are 3 conditions in a condition group, and for 2 of them 20 trials are defined, while for the 3rd condition only 10 trials are defined, then only 10 trials will be shown. However, when 0 trials are defined, such conditions can be excluded from the calculations, such that when there are 2 conditions with 20 trials and 1 condition with 0 trials defined, there are still 20 trials shown. This option can be useful for nested designs.
- Select trials in conditions by: This option will influence how trials are selected within one condition. This setting is only important if the number of trials should be different within one condition group (between conditions). For instance, if there are 20 trials defined in 2 conditions (of a condition group) but only 10 in the third one, only 10 trials are shown (as described above). However, for the 2 conditions which have 20 trials defined, one can choose whether only the first 10 trials can be selected, or whether the trial 11-20 could (as alternatives) also be selected. This option can be useful if you want to draw trials from conditions with different likelihoods.

The resulting table then shows for each condition group the following properties:

- Factor-Group: The factor group where the factors of the condition group are defined.
- Condition-Group: The condition group index.
- #Conditions: The number of conditions inside the condition group.
- #Shown Trials: The number of trials shown for the condition group.
- #Trial Variations: The number of trials (variations) defined within the condition group.

On the bottom of this menu, you will see the total number of trials (variations) within the overall task.

## Trials per Subject

By default, the number of trials per subject is calculated automatically. However, by choosing the option "Set Nr of Trials manually," users can set the number of trials per subject by hand. When the manual option is activated, this will also affect the internal functions of other randomization settings (i.e. Factor Randomization and Resulting Conditions-Groups & Trials).

## Simulation of trial sequence

As the name suggests, the "simulation of trial sequence" menu can be used to simulate a possible trial sequence for one subject. By clicking on the "Refresh" icon, a new possible sequence is calculated with the current settings taken into account. Here, one can also see the trial IDs and the condition number for each trial. On the bottom of this menu, you will see the total number of trials shown to each subject.