Shared Concepts

Effect Operators

Table 13 summarizes the operators that are available for selecting and constructing effects. These operators are discussed in the following sections.

Table 13: Available Effect Operators

Operator Example Description
Interaction effects={{vars={’A’,’B’}, interaction=’CROSS’}} Crosses the levels of the effects
Nesting effects={{vars=’B’,nest= ’A’}} Nests A levels within B levels
Bar operator effects={{vars={’A’,’B’}, interaction=’BAR’}} Specifies all interactions
Reduced-bar operator effects={{vars={’A’,’B’}, maxinteract=2}} Reduces interactions in bar effects
Regular expression effects={’/^A/’} Specifies all variables starting with "A"


Interaction (Cross) Operator

You can specify interaction effects by setting the interaction parameter to CROSS. Effects consisting of the interaction of every variable in the vars parameter are created. For example, the following effect parameter specification computes the interaction between the three variables A, B, and C:

effects={ {vars={'A', 'B', 'C'}, interaction='CROSS'} };

Denote interactions using asterisks (*), so this effect is also denoted as A*B*C. See the section Interaction Effects for more details.

Nesting Operator

Specifying the nest subparameter creates effects by nesting every variable in the nest parameter inside the vars parameter. For example, the following effect parameter specification nests the C levels inside each of the A and B levels:

effects={ {vars={'A', 'B'}, nest='C'} };

Effects are discarded if a variable occurs on both the nested and crossed parts of an effect. The following two specifications are identical:


effects={ {vars={'A','B'},nest={'A','C'}} }

effects={ {vars='A',nest='C'}, {vars='B',nest={'A','C'}} }

Similarly, the following two specifications are identical:


effects={ {vars={'A','B'},interaction='cross',nest={'A','C'}} }

effects={ {vars={'A','B'},interaction='cross',nest='C'} }

Denote nestings using parentheses, so the effect "A nested in B" is also denoted as A(B). See the section Nested Effects for more details.

Bar and Reduced-Bar Operators

You can shorten the specification of a large factorial model by using the bar operator. For example, the following code displays two ways of writing the effects for a full three-way factorial model. The bar expression in the first effects parameter is expanded from left to right, using rules 2–4 in Searle (1971, p. 390). This results in an ordering which is the same as that shown in the second effects parameter.

effects={ {vars={'A', 'B', 'C'}, interaction='BAR'} };

effects={ 'A', 'B',
          {vars={'A', 'B'}, interaction='CROSS'},
          'C'
          {vars={'A', 'C'}, interaction='CROSS'},
          {vars={'B', 'C'}, interaction='CROSS'},
          {vars={'A', 'B', 'C'}, interaction='CROSS'} };

Denote the bar operator with a vertical bar (|), so this effect is denoted as A|B|C.

Duplicate effects are removed. For example, the following two specifications are the same:

effects={ 'A',
          {vars={'A', 'A'}, interaction='CROSS'},
          'B'
          {vars={'A', 'B'}, interaction='CROSS'} };
          {vars={'A', 'A', 'B'}, interaction='CROSS'} };

effects={ {vars={'A', 'A', 'B'}, interaction='BAR'} };

To reduce the number of variables involved in any effect that results from a bar evaluation, you can specify a maximum number of interactions with the maxinteract subparameter. For example, the first two specifications in the following code select only main effects and their pairwise interactions, and both of these are equivalent to the third specification:

effects={ {vars={'A', 'B', 'C'}, maxinteract=2, interaction='BAR'} };

effects={ {vars={'A', 'B', 'C'}, maxinteract=2} };

effects={ 'A',
          'B',
          {vars={'A', 'B'}, interaction='CROSS'},
          'C'
          {vars={'A', 'C'}, interaction='CROSS'},
          {vars={'B', 'C'}, interaction='CROSS'},
Regular Expressions

You can simplify the specification of a large model when some of your variables have a common prefix by using regular expressions. For example, if your data set contains the variables X1 through X5, the following effects specifications are equivalent:

effects={vars={'X1', 'X2', 'X3', 'X4', 'X5'}}

effects={vars={'/^X/'}}

Here, the slashes (/) contain the regular expression, while the carat (^) anchors your request at the beginning of the variable name.

If your data set contains the variables X1 through X1000, and you want to select all variables that end with "99" then you use the dollar ($) to anchor your string at the end of the variable name:

effects={vars={'/99$/'}}

If your data set contains the variables X1 through X1000, and you only want to use the variables X8 through X19, then you can use the following effects specification:

effects={vars={'/^X([8-9]$|1\d$)/'}}

In this case, you search for a variable name starting with X, followed by the single-digit 8 or 9 or, alternatively (|), followed by the digit 1 and then one more digit (\d). The dollar sign at the end of each of these alternatives prevents the regular expression from also matching X80–X89, X800–X899, X90–x99, X900-X999, X100–X199, or X1000.

Last updated: March 05, 2026