|
|
|
||||
|
|
|||||
Interaction Contrasts
Example 12.1. Pairwise Interaction Contrast, Page 257 of Keppel.
Example 12.1a. SPSS MANOVA
Example 12.1b. SPSS GLM
Example 12.1c. SAS PROC GLM
Example 12.2. Complex Interaction Contrast, Page 259 of Keppel.
Example 12.2a. SPSS MANOVA
Example 12.2b. SPSS GLM
Example 12.2c. SAS PROC GLM
Example 12.3. Interaction Contrast from a large factorial design, Pages
262-265.
Example 12.3a. SPSS MANOVA
Example 12.3b. SPSS GLM
Example 12.3c. SAS PROC GLM
Summary: 12.1, 12.2, 12.3, Interaction Contrasts
Interaction Contrasts and Simple Effects Involving Tests of Trend
Example 12.4. Interaction Contrast Involving Tests of Trend, Page 269
of Keppel.
Example 12.4a. SPSS MANOVA
Example 12.4b. SPSS GLM
Example 12.4c. SAS PROC GLM
Summary: 12.4, Interaction Contrasts
Involving Tests of Trend
Example 12.5. Simple Effect Analysis using Trend Components, Page 270
of Keppel
Example 12.5a. SPSS MANOVA
Example 12.5b. SPSS GLM
Example 12.5c. SAS PROC GLM
Summary: 12.5, Simple Effect Analysis using
Trend Components
Partial Factorials
Example 12.6. Analysis of a Partial Factorial, Page 274 of Keppel
Example 12.6a. SPSS MANOVA
Example 12.6b. SPSS GLM
Example 12.6c. SAS PROC GLM
Summary: 12.6, Analysis of a Partial
Factorial
Interaction Contrasts
Keppel shows three examples of performing interaction contrasts, pairwise interaction contrasts, complex interaction contrasts, interaction contrasts from a large factorial design. Each of these examples is shown below.
12.1 Pairwise Interaction Contrasts, Page 257 of Keppel
Assume you wish to test an interaction contrast which crosses Acomp (a1 vs a3) by Bcomp (b1 vs b2) as shown on pages 255-257 of Keppel. This can be analyzed using SPSS manova, SPSS glm and SAS proc glm. These programs use the CHAP10 (SPSS, SAS) data file. (As a follow up to the above interaction contrast, a simple comparison is tested (page 258) which can be tested using the same principles shown in section 11.3.)
Example 12.1a. SPSS MANOVA
MANOVA dv BY a(1,3) b(1,2)
/ERROR = w
/CONTRAST(a) = SPECIAL(1 1 1
0 1 -1
-2 1 1)
/CONTRAST(b) = SPECIAL(1 1
1 -1)
/DESIGN = a b
a(1) BY b(1)
a(2) BY b(1).
The /constrast subcommand is used to supply the contrasts to be applied to factor A and factor B. The second row of the special matrix for factor A compares a2 with a3. The second row of the special matrix for factor B compares b1 with b2. The /design = a(1) by b(1) subcommand tells SPSS to cross the first contrast applied to factor A with the first contrast applied to factor B, i.e., to test the Acomp (a2 vs a3) by Bcomp (b1 vs b2) interaction contrast.
Example 12.1b. SPSS GLM
GLM errors BY a b
/LMATRIX = 'Acomp BY Bcomp' a*b 0 0
1 -1
-1 1 .
The /lmatrix subcommand is used to request the test of the interaction comparison of Acomp (a1 vs a3) by Bcomp (b1 vs b2). The coefficients for the /lmatrix subcommand are derived as shown in Keppel in Table 12-3 (page 256), by crossing (multiplying) the coefficients applied to factor A by the coefficients applied to factor B. There is one important difference, though. The variable which appears earliest on the by clause of the glm command represents the rows of the matrix of coefficients shown in the /lmatrix subcommand. Hence, factor A represents the rows, and factor B represents the columns of the coefficients supplied in the /lmatrix subcommand. Switching the rows and columns of Table 12-3 yields the coefficients used in the /lmatrix subcommand in this example.
Example 12.1c. SAS PROC GLM
PROC GLM DATA=chap10;
CLASS a b;
MODEL errors = a b a*b;
CONTRAST 'Acomp by Bcomp' a*b 0 0
1 -1
-1 1 ;
RUN;
The contrast statement is used to request the test of the interaction comparison of Acomp (a1 vs a3) by Bcomp (b1 vs b2). The coefficients for the contrast statement are derived as shown in Keppel in Table 12-3 (page 256), by crossing (multiplying) the coefficients applied to factor A by the coefficients applied to factor B. There is one important difference, though. The variable which appears earliest on the class statement represents the rows of the matrix of coefficients shown in the contrast statement. Hence, factor A represents the rows, and factor B represents the columns of the coefficients supplied in the contrast statement. Switching the rows and columns of Table 12-3 yields the coefficients used in the contrast statement in this example.
12.2 Complex Interaction Contrasts, Pages 258-259 of Keppel
On Pages 258-259, Keppel illustrates a complex interaction contrast. When computed by hand, this involves a different analysis strategy. However, the analysis strategy is basically the same using SPSS manova, SPSS glm, and SAS proc glm. These programs use the CHAP10 (SPSS, SAS) data file.
Example 12.2a. SPSS MANOVA
MANOVA dv BY a(1,3) b(1,2)
/ERROR = w
/CONTRAST(a) = SPECIAL(1 1 1
1 -0.5 -0.5
0 -1 1 )
/CONTRAST(b) = SPECIAL(1 1
1 -1)
/DESIGN = a b
a(1) BY b(1)
a(2) BY b(1).
Like Example 12.1a, the /contrast subcommand is used to specify the contrast coefficients to be applied to factor A and factor B. The /design subcommand is used to cross Acomp by Bcomp, forming the interaction contrast.
Example 12.2b. SPSS GLM
GLM errors BY a b
/LMATRIX = 'Acomp BY Bcomp' a*b 1 -1
-1/2 1/2
-1/2 1/2.
Like Example 12.1b, the /lmatrix subcommand is used to request the test of an interaction contrast. The coefficients are derived using the same process, as shown in Table 12-4. However, because factor a preceded factor b on the by clause of the glm command, factor a represents rows, and factor b represents columns. Switching the rows and columns of Table 12-4 yields the values used in the /lmatrix subcommand for this example.
Example 12.2c. SAS PROC GLM
PROC GLM DATA=chap10;
CLASS a b;
MODEL errors = a b a*b;
CONTRAST 'Acomp by Bcomp' a*b 1 -1
-0.5 0.5
-0.5 0.5;
RUN;
Like Example 12.1c, the contrast statement is used to request the test of an interaction contrast. The coefficients are derived using the same process, as shown in Table 12-4. However, because factor a preceded factor b on the class statement, factor a represents rows, and factor b represents columns. Switching the rows and columns of Table 12-4 yields the values used in the contrast statement for this example.
12.3 Interaction contrasts from large factorial designs, Pages 262-265.
A third example of an interaction contrast is presented on pages 262-265 of Keppel. This example uses a different example data file, where there are 3 levels of factor A and 3 levels of factor B. This example shows the interaction contrast formed by crossing Acomp (a1 vs a2,a3) by Bcomp (b2 vs b3). This analysis can be performed using SPSS manova, SPSS glm, and SAS proc glm as shown below. These examples use the CHAP12 (SPSS, SAS) data file. (This analysis is followed by tests of simple comparisons. Such tests can be performed using the same strategy as presented in section 11.3.)
Example 12.3a. SPSS MANOVA
MANOVA dv BY a(1,3) b(1,3)
/ERROR = w
/CONTRAST(a) = SPECIAL(1 1 1
1 -0.5 -0.5
0 -1 1 )
/CONTRAST(b) = SPECIAL(1 1 1
0 -1 1
-2 1 1 )
/DESIGN = a b
a(1) BY b(1)
a(1) BY b(2)
a(2) BY b(1)
a(2) BY b(2).
Like Examples 12.1a and 12.2a, the /contrast subcommand is used to specify the contrasts which are applied to factors A and B and the /design subcommand is used to cross Acomp by Bcomp, forming the interaction contrast
Example 12.3b. SPSS GLM
GLM memory BY a b
/LMATRIX = 'Acomp BY Bcomp' a*b 0 1 -1
0 -1/2 1/2
0 -1/2 1/2.
Like Examples 12.1b and 12.2b, the coefficients in the /lmatrix are derived by multiplying the contrast coefficients applied to factors A and B. These coefficients are shown in Table 12-8 (Page 264) of Keppel. However, because factor a preceded factor b on the by clause of the glm command, factor a represents rows, and factor b represents columns, therefore the rows and columns in Table 12-8 must be switched when used in this /lmatrix subcommand.
Example 12.3c. SAS PROC GLM
PROC GLM data=chap12;
CLASS a b;
MODEL memory = a b a*b;
CONTRAST 'Acomp by Bcomp' a*b 0 1 -1
0 -0.5 0.5
0 -0.5 0.5;
RUN;
Like Examples 12.1c and 12.2c, the coefficients in the contrast statement derived by multiplying the contrast coefficients applied to factors A and B. These coefficients are shown in Table 12-8 (Page 264) of Keppel. However, because factor a preceded factor b on the class statement, factor a represents rows, and factor b represents columns, therefore the rows and columns in Table 12-8 must be switched when used in this contrast statement.
Summary: 12.1, 12.2, 12.3, Interaction Contrasts
There are two interesting points to note from these examples. First, regardless of the type of interaction contrast being tested (pairwise, complex, or from a large factorial design), the strategy remained the same. Second, these examples showed that SPSS glm and SAS proc glm are extremely identical in their approach to testing interaction contrasts, yet were quite different from SPSS manova.
In essence, with SPSS manova, the /constrast subcommand is used to show the coefficients to be applied to each factor, and the /design subcommand is used to cross the contrasts to form the interaction contrast. It can be convenient to let SPSS manova multiply the effects for you, but typing the /contrast and /design subcommands may be tiresome. On the other hand, SPSS glm and SAS proc glm require you to multiply the contrast coefficients yourself, but there is greater parsimony in specifying the interaction contrast directly in the form of the /lmatrix subcommand or contrast statement.
Because each strategy offers its own benefits, choose the method with which you feel most comfortable. Also, you may wish to choose SPSS glm or SAS proc glm for simple interaction contrasts (when multiplying the contrasts is easy), and choose SPSS manova for complex interaction contrasts (when multiplying the contrasts is more tricky). Also, it never hurts to use both strategies to double check your results!
Interaction Contrasts and Simple Effects Involving Tests of Trend
Example 12.4 Interaction Contrast Involving Tests of Trend, Page 269 of Keppel.
On page 269, Keppel presents an example of a special kind of interaction contrast involving a test of trend. Example 12.2a shows how this problem can be solved using SPSS manova, SPSS glm, and SAS proc glm. These examples use the CHAP10 (SPSS, SAS) data file.
Example 12.4a SPSS MANOVA
MANOVA dv BY a(1,3) b(1,2)
/ERROR = w
/CONTRAST(a) = POLYNOMIAL
/CONTRAST(b) = SPECIAL(1 1
1 -1)
/DESIGN = a b
a(1) by b(1)
a(2) by b(1).
This problem could be solved using the strategies shown in examples 12.1a, 12.2a, or 12.3a, but this would require the user to supply the trend coefficients in the special matrix. Example 12.4a uses the /contrast(a) = polynomial subcommand to supply linear and quadratic contrast coefficients to factor A. In the /design subcommand, the effect a(1) refers to the linear effect of factor A, and a(2) refers to the quadratic effect of factor A. So, the /design = a(1) by b(1) subcommand instructs SPSS manova to cross Alinear by Bcomp (where Bcomp compares b1 with b2).
Example 12.4b SPSS GLM
GLM errors BY a b
/LMATRIX = 'Alinear by Bcomp' a*b -1 1
0 0
1 -1.
Analyzing an interaction contrast which involves a test of trend in SPSS glm is no different than analyzing an ordinary interaction contrast (like Examples 12.1b, 12.2b, or 12.3b). As these previous examples showed, the trend coefficients for the two effects are multiplied together, as shown in Table 12-10. Because factor a precedes factor b on the by clause, factor a represents rows of the /lmatrix, hence the rows and columns of Table 12-10 are switched, as shown in the example above.
Example 12.4c SAS PROC GLM
PROC GLM DATA=chap10;
CLASS a b;
MODEL errors = a b a*b;
CONTRAST 'Alinear by Bcomp' a*b -1 1
0 0
1 -1;
RUN;
Analyzing an interaction contrast which involves a test of trend in SAS proc glm is no different than analyzing an ordinary interaction contrast (like Examples 12.1c, 12.2c, or 12.3c). As these previous examples showed, the trend coefficients for the two effects are multiplied together, as shown in Table 12-10. Because factor a precedes factor b on the class statement, factor a represents rows in the contrast statement, hence the rows and columns of Table 12-10 are switched, as shown in the example above.
Summary: 12.4, Interaction Contrast Involving Tests of Trend
SPSS manova offers a distinct shortcut in tests of trend by offering the polynomial keyword to be used with the /contrast subcommand. This can be very useful for tests of trend involving factors with a large number of levels. However, for factors which involve a small number of levels, you can simply look up the appropriate trend coefficients in Keppel and manually supply the trend coefficients using SPSS glm or SAS proc glm. Again, your choice of strategy will depend on the nature of the problem, and the method with which you feel most comfortable.
Example 12.5 Simple Effect Analysis using Trend Components, Page 269 of Keppel.
Given the significant results in Example 12.4, a natural follow up test is to test simple trend effects. As shown on pages 269 and 270, Keppel tests the linear effect of factor A at each level of factor B. This can be tested using SPSS manova, SPSS glm, and SAS proc glm. Each of these examples use the CHAP10 (SPSS, SAS) data file.
Example 12.5a. SPSS MANOVA
MANOVA dv BY a(1,3) b(1,2)
/ERROR = w
/CONTRAST(a) = polynomial
/DESIGN = b
a(1) WITHIN b(1)
a(1) WITHIN b(2)
a(2) WITHIN b(1)
a(2) WITHIN b(2).
This could be tested using the simple comparison strategy shown in Example 11.3a, but because this test involves a test of trend, the problem can be solved in SPSS using the polynomial keyword in the /contrast subcommand, as shown in Example 12.2b.In this program, the effect a(1) within b(1) refers to the linear effect of factor A at level 1 of factor B (Alinear at B1), and a(1) within b(2) refers to the linear effect of factor A at level 2 of factor B (Alinear at B2).
Example 12.5a. SPSS GLM
GLM errors BY a b
/LMATRIX = 'Alinear at b1' a -1
0
1
a*b -1 0
0 0
1 0
/LMATRIX = 'Alinear at b2' a -1
0
1
a*b 0 -1
0 0
0 1.
This example uses the same strategy as shown in Example 11.3b to perform a simple effect analysis. In this case, the comparison happens to be a linear comparison, which means that the coefficients -1 0 1 will be used to obtain a linear effect of factor A. The first /lmatrix subcommand obtains the effect of Alinear at b1, and the second /lmatrix subcommand obtains the effect of Alinear at b2, For more information, see Example 11.3b.
Example 12.5a. SAS PROC GLM
PROC GLM DATA=chap10;
CLASS a b;
MODEL errors = a b a*b;
CONTRAST 'Alinear at b1' a -1
0
1
a*b -1 0
0 0
1 0;
CONTRAST 'Alinear at b2' a -1
0
1
a*b 0 -1
0 0
0 1;
RUN;
This example uses the same strategy as shown in Example 11.3c to perform a simple effect analysis. In this case, the comparison happens to be a linear comparison, which means that the coefficients -1 0 1 will be used to obtain a linear effect of factor A. The first contrast statement obtains the effect of Alinear at b1, and the second contrast statement obtains the effect of Alinear at b2, For more information, see Example 11.3c.
Summary: 12.4, Simple Effect Analysis using Trend Components
As we saw in Section 11.3, it can be much simpler to perform tests of simple effects using SPSS manova than to use SPSS glm or SAS proc glm. SPSS manova makes simple effects which involve tests of trend even simpler by offering the POLYNOMIAL keyword which can be used with the /contrast subcommand. By comparison, SPSS glm and SAS proc glm requires the hand coding of coefficients to specify the simple effects, which can be quite tricky.
Partial Factorials
12.6 Analysis of Partial Factorials , Pages 272-275 of Keppel
On Pages 272-275, Keppel demonstrates how a partial factorial can be analyzed. This example shows how to test the effect of Acomp. By B (where Acomp compares a1 with a2,a3). This can be solved with SPSS manova, SPSS glm, or SAS proc glm, as shown below. Each example uses the CHAP12 (SPSS, SAS) data file.
Example 12.6a. SPSS MANOVA
MANOVA dv BY a(1,3) b(1,3)
/ERROR = w
/CONTRAST(a) = SPECIAL(1 1 1
1 -0.5 -0.5
0 -1 1 )
/DESIGN = a b
a(1) BY b
a(2) BY b.
As this example shows, the /contrast is used to form the comparison Acomp which compares a1 with a2,a3 (as shown in the second row of the special matrix). The /design = a(1) by b requests the test of Acomp. By B, the partial interaction.
Example 12.6b. SPSS GLM
GLM memory BY a b
/LMATRIX = 'Acomp by B' a*b -1 0 1
1/2 0 -1/2
1/2 0 -1/2;
a*b 1 -2 1
-1/2 1 -1/2
-1/2 1 -1/2.
In SPSS glm, the /lmatrix subcommand is used to test partial interactions. Unlike previous examples, a partial interaction is a multiple degree of freedom test. In this example, Acomp. By B, the test has 2 df because factor B has 2 df. The 2 df of factor B can be broken down into 2 orthogononal comparisons (e.g., Blinear and Bquadratic). The partial interaction is formed as a series of interaction contrasts crossing Acomp. by Blinear , Acomp. by Bquadratic. In this example, the partial interaction is formed as the combination of two interaction comparisons, Acomp. by Blinear and Acomp. by Bquadratic (see Example 12.1b for more information on specifying interaction contrasts). As this example shows, these two interaction contrasts are separated by a semi-colon, which tells SPSS to join these contrasts together into a multi degree of freedom test.
Example 12.6. SAS PROC GLM
PROC GLM DATA=chap12;
CLASS a b;
MODEL memory = a b a*b;
CONTRAST 'Acomp by B' a*b -1 0 1
0.5 0 -0.5
0.5 0 -0.5,
a*b 1 -2 1
-0.5 1 -0.5
-0.5 1 -0.5;
RUN;
In SAS proc glm, the contrast statement is used to test partial interactions. Unlike previous examples, a partial interaction is a multiple degree of freedom test. In this example, Acomp. By B, the test has 2 df because factor B has 2 df. The 2 df of factor B can be broken down into 2 orthogononal comparisons (e.g., Blinear and Bquadratic). The partial interaction is formed as a series of interaction contrasts crossing Acomp. by Blinear , Acomp. by Bquadratic. In this example, the partial interaction is formed as the combination of two interaction comparisons, Acomp. by Blinear and Acomp. by Bquadratic (see Example 12.1c for more information on specifying interaction contrasts). As this example shows, these two interaction contrasts are separated by a comma, which tells SAS to join these contrasts together into a multi degree of freedom test.
Summary: 12.6, Analysis of Partial Factorials
As these examples showed, it can be quite complicated to specify a partial interaction using SPSS glm or SAS proc glm. Computing the coefficients for the partial interactions could be prone to error and tedious. By contrast SPSS manova seems to offer a more intuitive approach to this analysis. Using SPSS manova, the contrast coefficients Acomp. are specified in the /contrast subcommand, and then the /design subcommand is used to specify the partial interaction. This approach seems much simpler, and less prone to error.
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services