Press "Enter" to skip to content

Tutorial: Randomizing trials that are paired across trial templates

There are lots of situations where you’ll want to randomize the order of your trials so that you can avoid potential order-of-presentation effects. This can easily be accomplished by setting the order property of your block to randomized_trials. But in blocks where you have multiple trial templates, it might be important to keep the trials across templates paired together, even if you want those yoked pairs to be presented in a random (but paired) order. This tutorial will show you how FindingFive can easily yoke trials across trial templates that are realized within a block, even if you want the yoked trials to be presented in a random order.

To demonstrate how to randomly order yoked trials in FindingFive, we’ll build a toy version of a simple associative priming lexical decision task. In this task, people are faster to say that a target stimulus (like the word nurse) is a real word when that stimulus is primed with a semantically-related word (like doctor) as compared to being primed with an unrelated word (like bread) (e.g., Meyer & Schvaneveldt, 1971). In our toy version, each trial will present a prime word for a short period of time before a target word appears. Then we’ll collect a yes/no two alternative forced choice response — and the response time of that choice — about whether the target is a word (e.g., nurse) or not (e.g., nrsue).

The structure of a trial for our toy version of an associative priming lexical decision task.

In the code snippet below, we create a trial template whose stimuli consist of some prime words (p1, p2, p3, and p4) that we want to yoke to some target words who are defined in another trial template. Some of the primes will be semantically related to certain targets, and some won’t be. But crucially, we’ll want to control the pairing of primes to targets. (This means we want to control the randomization at the block level, not the trial template level. Therefore, we won’t set the trial template stimulus_pattern to random.)

"primes_template": {
  "type": "basic",
  "stimuli": ["p1", "p2", "p3", "p4"]

"targets_template": {
  "type": "AFC",
  "stimuli": ["t1", "t2", "t3", "t4"],
  "responses": ["lexical_decision"]

Now we want to present these trials together in a block, such that the trial corresponding to the prime “p1” from primes_template is paired up with the trial corresponding to the target “t1” in target_template, and so on. If we wanted to present the prime-target yoked pairs in the exact order we listed them as stimuli in our trial templates (i.e., if we wanted the trial order to be p1-t1, p2-t2, p3-t3, p4-t4 for all participants), we would set the order of our block to be alternate.

"target_prime_lexical_decision_block": {
    "trial_templates": ["primes_template", "targets_template"],
    "pattern": {"order": "alternate", "repeat": 1} // the property "repeat" sets how many times the block will cycle through all trial templates in this block

However, it’s more likely that we want to have a randomized order of prime-target pair presentations for each participant to avoid potential order effects. FindingFive allows you to easily accomplish this using the alternate_random setting for a block’s order property. As long as the trial templates in the block have the same number of trials (in this case, 4), we can pair the trials together in the order in which they are defined, and have the yoked pairs presented in a random order for each participant:

"target_prime_lexical_decision_block": {
    "trial_templates": ["primes_template", "targets_template"],
    "pattern": {"order": "alternate_random", "repeat": 1}

The alternate_random ordering option will:

  1. Go template-to-template in the order listed in the block’s “trial_templates” definition (in this case, starting with primes_template and then going to targets_template),
  2. Select the first trial from each template and ‘yoke’ them together, preserving their relative ordering from #1,
  3. Repeat for the second, third, etc. trials of those templates until no trials remain,
  4. Randomize the ordering of each yoked set of trials.

And so, in the end, one participant might see the ordering p2, t2, p4, t4, p1, t1, p3, t3, while the next participant sees the ordering p1, t1, p2, t2, p3, t3, p4, t4.

This logic is not limited to two trial templates, either. As long as the templates define the same number of trials in a fixed order, the block can include an arbitrary number of these yoked templates. The alternate_random ordering pattern will always work through the templates left-to-right, selecting one trial from each, and yoke them together; then it will shuffle the relative ordering of the yoked sets of trials. Thus, the nth stimulus of one trial template will always be paired with the nth stimulus of all other trial templates in the block. Again, it is crucial that all trial templates in a yoked block have the same number of trials, which we accomplished in this example by having the same number of primes and targets.

For more technical details about how to control the order of presentation of your study’s trials, check out the Procedures section of the FindingFive API.

If you have any questions about this post or how to adjust the presentation order of trials in FindingFive, please don’t hesitate to contact us at!