Shared Statistical Concepts


Bar and At Sign Operators

You can shorten the specification of a large factorial model by using the bar operator. For example, two ways of writing the model for a full three-way factorial model follow:


model Y = A B C   A*B A*C B*C   A*B*C;

model Y = A|B|C;

When the bar (|) is used, the right and left sides become effects, and the cross of them becomes an effect. Multiple bars are permitted. The expressions are expanded from left to right, using rules 2–4 given in Searle (1971, p. 390).

  • Multiple bars are evaluated from left to right. For example, A | B | C is evaluated as follows:

    A | B | C

    $\rightarrow $

    $\{ $ A | B $\} $ | C

     

    $\rightarrow $

    $\{ $ A  B  A*B $\} $ | C

     

    $\rightarrow $

    A  B  A*B  C  A*C  B*C  A*B*C

  • Crossed and nested groups of variables are combined. For example, A(B) | C(D) generates A*C(B D), among other terms.

  • Duplicate variables are removed. For example, A(C) | B(C) generates A*B(C C), among other terms, and the extra C is removed.

  • Effects are discarded if a variable occurs on both the crossed and nested parts of an effect. For example, A(B) | B(D E) generates A*B(B D E), but this effect is eliminated immediately.

You can also specify the maximum number of variables involved in any effect that results from bar evaluation by specifying that maximum number, preceded by an at sign (@), at the end of the bar effect. For example, the following specification selects only those effects that contain two or fewer variables:


model Y = A|B|C@2;

The preceding example is equivalent to specifying the following MODEL statement:


model Y = A B C   A*B A*C B*C;

More examples of using the bar and at operators follow:

A | C(B)

is equivalent to

A   C(B)   A*C(B)

A(B) | C(B)

is equivalent to

A(B)   C(B)   A*C(B)

A(B) | B(D E)

is equivalent to

A(B)   B(D E)

A | B(A) | C

is equivalent to

A   B(A)   C   A*C   B*C(A)

A | B(A) | C@2

is equivalent to

A   B(A)   C   A*C

A | B | C | D@2

is equivalent to

A  B  A*B  C  A*C  B*C  D  A*D  B*D  C*D

A*B(C*D)

is equivalent to

A*B(C D)