Home

Trials logic

The trials logic section provides a rule editor for applying logic to each trial. Rules are built by selecting items from dropdown menus and come in two varieties:

  • assignment: These rules use the keyword LET and simply assign values. Generally you would use these rules when defining default values, for example setting correct to false in a trial where unless the response is correct (defined by later rules) it is deemed incorrect.
  • conditional: These rules use the keyword IF and use conditional logic. These rules can be used for defining default values, to determine the correctness of a response or assign levels. For example, (Figure 1) shows some rules for assigning whether or not a response is correct in a lexical decision task. Rule 3 specifies that if level is non-word and the keyboard key pressed by the participant (response) is the key assigned to pair contains a non-word then the response is correct. Conversely, if level is non-word and the keyboard key pressed by the participant (response) is the key assigned to pair only contains real words then the rule does not match and Rule 1 will remain applied.

Rule evaluation

Rules follow the laws of conditional logic and have the following evaluation properties:

  • left to right: for example, A and B or C will be evaluated by first resolving (A and B) and then the result will be applied to the rest of the rule, in this case (ABResult or C).
  • rule precedence: All rules are sequentially evaluated for each trial in the order they appear in the rules table with later rules taking precedence over earlier rules. For example, after the rules in (Figure 1) are evaluated, if rule 2 or rule 3 are evaluated to be true then correct will be set to true, otherwise correct will remain false.
Note: response constructs such as keyboard response and buttons response also have their own events. These events are not affected by trials rules.

Figure 1. Rule precedence example (Psychstudio)

Figure 1. Rule precedence example

Adding a rule

Click New rule to add a new rule.

Deleting a rule

Rules can be deleted by selecting the rule using the checkbox and clicking Delete in the toolbar. You can also select and delete multiple rules at once.

Reordering rules

The order of rules can be changed by dragging and dropping within the table.