Shared Concepts

GLM Parameterization of Classification Variables and Effects

Table 3.12 shows the types of effects that are available in procedures in this book; they are discussed in more detail in the following subsections. Let A, B, and C represent classification variables, and let X and Z represent continuous variables.

Table 3.12: Available Types of Effects

Effect

Example

Description

Intercept

Default

Intercept (unless the NOINT option is specified)

Regression

X Z

Continuous variables

Polynomial

X*Z

Interaction of continuous variables

Main

A B

CLASS variables

Interaction

A*B

Crossing of CLASS variables

Nested

A(B)

Main effect A nested within CLASS effect B

Continuous-by-class

X*A

Crossing of continuous and CLASS variables

Continuous-nesting-class

X(A)

Continuous variable X1 nested within CLASS variable A

General

X*Z*A(B)

Combinations of different types of effects


Table 3.13 shows some examples of MODEL statements that use various types of effects.

Table 3.13: MODEL Statement Effect Examples

Specification

Type of Model

model Y=X;

Simple regression

model Y=X Z;

Multiple regression

model Y=X X*X;

Polynomial regression

model Y=A;

One-way analysis of variance (ANOVA)

model Y=A B C;

Main-effects ANOVA

model Y=A B A*B;

Factorial ANOVA with interaction

model y=A B(A) C(B A);

Nested ANOVA

model Y=A X;

Analysis of covariance (ANCOVA)

model Y=A X(A);

Separate-slopes regression

model Y=A X X*A;

Homogeneity-of-slopes regression


Intercept

By default, linear models that are created by procedures in this book automatically include a column of 1s in . This column corresponds to an intercept parameter. In many procedures, you can use the NOINT option in the MODEL statement to suppress this intercept. For example, the NOINT option is useful when the MODEL statement contains a classification effect and you want the parameter estimates to be in terms of the mean response for each level of that effect.

Regression Effects

Numeric variables or polynomial terms that involve them can be included in the model as regression effects (covariates). The actual values of such terms are included as columns of the relevant model matrices. You can use the bar operator along with a regression effect to generate polynomial effects. For example, X | X | X expands to X X*X X*X*X, which is a cubic model.

Main Effects

If a classification variable has m levels, the GLM parameterization generates m columns for its main effect in the model matrix. Each column is an indicator variable for a particular level. The order of the columns is the sort order of the values of their levels and can be controlled by the ORDER= option in the CLASS statement.

Table 3.14 is an example where denotes the intercept and A and B are classification variables that have two and three levels, respectively.

Table 3.14: Example of Main Effects

Data

 

I

 

A

 

B

A

B

 

 

A1

A2

 

B1

B2

B3

1

1

 

1

 

1

0

 

1

0

0

1

2

 

1

 

1

0

 

0

1

0

1

3

 

1

 

1

0

 

0

0

1

2

1

 

1

 

0

1

 

1

0

0

2

2

 

1

 

0

1

 

0

1

0

2

3

 

1

 

0

1

 

0

0

1


There are usually more columns for these effects than there are degrees of freedom to estimate them. In other words, the GLM parameterization of main effects is singular.

Interaction Effects

Often a model includes interaction (crossed) effects to account for how the effect of a variable changes along with the values of other variables. With an interaction, the terms are first reordered to correspond to the order of the variables in the CLASS statement. Thus, B*A becomes A*B if A precedes B in the CLASS statement. Then, the GLM parameterization generates columns for all combinations of levels that occur in the data. The order of the columns is such that the rightmost variables in the interaction change faster than the leftmost variables (Table 3.15).

Table 3.15: Example of Interaction Effects

Data

 

I

 

A

 

B

 

A*B

A

B

 

 

A1

A2

 

B1

B2

B3

 

A1B1

A1B2

A1B3

A2B1

A2B2

A2B3

1

1

 

1

 

1

0

 

1

0

0

 

1

0

0

0

0

0

1

2

 

1

 

1

0

 

0

1

0

 

0

1

0

0

0

0

1

3

 

1

 

1

0

 

0

0

1

 

0

0

1

0

0

0

2

1

 

1

 

0

1

 

1

0

0

 

0

0

0

1

0

0

2

2

 

1

 

0

1

 

0

1

0

 

0

0

0

0

1

0

2

3

 

1

 

0

1

 

0

0

1

 

0

0

0

0

0

1


In the preceding matrix, main-effects columns are not linearly independent of crossed-effects columns. In fact, the column space for the crossed effects contains the space of the main effect.

When your model contains many interaction effects, you might be able to code them more parsimoniously by using the bar operator ( | ). The bar operator generates all possible interaction effects. For example, A | B | C expands to A B A*B C A*C B*C A*B*C. To eliminate higher-order interaction effects, use the at sign (@) in conjunction with the bar operator. For example, A | B | C | D@2 expands to A B A*B C A*C B*C D A*D B*D C*D.

Nested Effects

Nested effects are generated in the same manner as crossed effects. Hence, the design columns that are generated by the following two statements are the same (but the ordering of the columns is different):

model Y=A B(A);

model Y=A A*B;

The nesting operator in procedures in this book is more of a notational convenience than an operation that is distinct from crossing. Nested effects are typically characterized by the property that the nested variables do not appear as main effects. The order of the variables within nesting parentheses is made to correspond to the order of these variables in the CLASS statement. The order of the columns is such that variables outside the parentheses index faster than those inside the parentheses, and the rightmost nested variables index faster than the leftmost variables (Table 3.16).

Table 3.16: Example of Nested Effects

Data

 

I

 

A

 

B(A)

A

B

 

 

A1

A2

 

B1A1

B2A1

B3A1

B1A2

B2A2

B3A2

1

1

 

1

 

1

0

 

1

0

0

0

0

0

1

2

 

1

 

1

0

 

0

1

0

0

0

0

1

3

 

1

 

1

0

 

0

0

1

0

0

0

2

1

 

1

 

0

1

 

0

0

0

1

0

0

2

2

 

1

 

0

1

 

0

0

0

0

1

0

2

3

 

1

 

0

1

 

0

0

0

0

0

1


Continuous-Nesting-Class Effects

When a continuous variable nests or crosses with a classification variable, the design columns are constructed by multiplying the continuous values into the design columns for the classification effect (Table 3.17).

Table 3.17: Example of Continuous-Nesting-Class Effects

Data

 

I

 

A

 

X(A)

X

A

 

 

A1

A2

 

X(A1)

X(A2)

21

1

 

1

 

1

0

 

21

0

24

1

 

1

 

1

0

 

24

0

22

1

 

1

 

1

0

 

22

0

28

2

 

1

 

0

1

 

0

28

19

2

 

1

 

0

1

 

0

19

23

2

 

1

 

0

1

 

0

23


This model estimates a separate intercept and a separate slope for X within each level of A.

Continuous-by-Class Effects

Continuous-by-class effects generate the same design columns as continuous-nesting-class effects. Table 3.18 shows the construction of the X*A effect. The two columns for this effect are the same as the columns for the X(A) effect in Table 3.17.

Table 3.18: Example of Continuous-by-Class Effects

Data

 

I

 

X

 

A

 

X*A

X

A

 

 

X

 

A1

A2

 

X*A1

X*A2

21

1

 

1

 

21

 

1

0

 

21

0

24

1

 

1

 

24

 

1

0

 

24

0

22

1

 

1

 

22

 

1

0

 

22

0

28

2

 

1

 

28

 

0

1

 

0

28

19

2

 

1

 

19

 

0

1

 

0

19

23

2

 

1

 

23

 

0

1

 

0

23


You can use continuous-by-class effects together with pure continuous effects to test for homogeneity of slopes.

General Effects

An example that combines all the effects is X1*X2*A*B*C(D E). The continuous list comes first, followed by the crossed list, followed by the nested list in parentheses.

Effects might be renamed by the procedure to correspond to ordering rules. For example, B*A(E D) might be renamed A*B(D E) to satisfy the following:

  • Classification variables that occur outside parentheses (crossed effects) are sorted in the order in which they appear in the CLASS statement.

  • Variables within parentheses (nested effects) are sorted in the order in which they appear in the CLASS statement.

The sequencing of the parameters that are generated by an effect is determined by the variables whose levels are indexed faster:

  • Variables in the crossed list index faster than variables in the nested list.

  • Within a crossed or nested list, variables to the right index faster than variables to the left.

For example, suppose that a model includes four effects—A, B, C, and D—each having two levels, 1 and 2, and that the CLASS statement is as follows:

class A B C D;

Then the order of the parameters for the effect B*A(C D), which is renamed A*B(C D), is as follows:

Note that first the crossed effects B and A are sorted in the order in which they appear in the CLASS statement so that A precedes B in the parameter list. Then, for each combination of the nested effects in turn, combinations of A and B appear. The B effect changes fastest because it is rightmost in the cross list. Then A changes next fastest, and D changes next fastest. The C effect changes most slowly because it is leftmost in the nested list.

Last updated: June 14, 2018