(View the complete code for this example.)
This section illustrates several different codings of classification variables and hence several different ways of fitting two-way ANOVA models to some data. Each example fits an ANOVA model, displays the ANOVA table and parameter estimates, and displays the coded design matrix. Note throughout that the ANOVA tables and R squares are identical for all of the models, showing that the codings are equivalent. For each model, the parameter estimates are stated as a function of the cell means. The formulas are appropriate for a design such as this one, which is balanced and orthogonal (every level and every pair of levels occurs equally often). They will not work with unequal frequencies. Since this data set has
cells, the full-rank codings all have six parameters. The following statements create the input data set, and display it in Figure 43:
title 'Two-Way ANOVA Models';
data x;
input a b @@;
do i = 1 to 2; input y @@; output; end;
drop i;
datalines;
1 1 16 14 1 2 15 13
2 1 1 9 2 2 12 20
3 1 14 8 3 2 18 20
;
proc print label;
run;
Figure 43: Input Data Set
| 1 |
1 |
16 |
| 1 |
1 |
14 |
| 1 |
2 |
15 |
| 1 |
2 |
13 |
| 2 |
1 |
1 |
| 2 |
1 |
9 |
| 2 |
2 |
12 |
| 2 |
2 |
20 |
| 3 |
1 |
14 |
| 3 |
1 |
8 |
| 3 |
2 |
18 |
| 3 |
2 |
20 |
The following statements fit a cell-means model and produce Figure 44 and Figure 45:
proc transreg data=x ss2 short;
title2 'Cell-Means Model';
model identity(y) = class(a * b / zero=none);
output replace;
run;
proc print label;
run;
Figure 44: Cell-Means Model
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
15.0000000 |
450.000 |
450.000 |
30.68 |
0.0015 |
a 1 * b 1 |
| 1 |
14.0000000 |
392.000 |
392.000 |
26.73 |
0.0021 |
a 1 * b 2 |
| 1 |
5.0000000 |
50.000 |
50.000 |
3.41 |
0.1144 |
a 2 * b 1 |
| 1 |
16.0000000 |
512.000 |
512.000 |
34.91 |
0.0010 |
a 2 * b 2 |
| 1 |
11.0000000 |
242.000 |
242.000 |
16.50 |
0.0066 |
a 3 * b 1 |
| 1 |
19.0000000 |
722.000 |
722.000 |
49.23 |
0.0004 |
a 3 * b 2 |
Figure 45: Cell-Means Model, Design Matrix
| SCORE |
ROW1 |
16 |
. |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
| SCORE |
ROW2 |
14 |
. |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
| SCORE |
ROW3 |
15 |
. |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
2 |
| SCORE |
ROW4 |
13 |
. |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
2 |
| SCORE |
ROW5 |
1 |
. |
0 |
0 |
1 |
0 |
0 |
0 |
2 |
1 |
| SCORE |
ROW6 |
9 |
. |
0 |
0 |
1 |
0 |
0 |
0 |
2 |
1 |
| SCORE |
ROW7 |
12 |
. |
0 |
0 |
0 |
1 |
0 |
0 |
2 |
2 |
| SCORE |
ROW8 |
20 |
. |
0 |
0 |
0 |
1 |
0 |
0 |
2 |
2 |
| SCORE |
ROW9 |
14 |
. |
0 |
0 |
0 |
0 |
1 |
0 |
3 |
1 |
| SCORE |
ROW10 |
8 |
. |
0 |
0 |
0 |
0 |
1 |
0 |
3 |
1 |
| SCORE |
ROW11 |
18 |
. |
0 |
0 |
0 |
0 |
0 |
1 |
3 |
2 |
| SCORE |
ROW12 |
20 |
. |
0 |
0 |
0 |
0 |
0 |
1 |
3 |
2 |
The next model is a reference cell model, and the default reference cell is the last cell, which in this case is the (3,2) cell. The following statements fit a reference cell model and produce Figure 46 and Figure 47:
proc transreg data=x ss2 short;
title2 'Reference Cell Model, (3,2) Reference Cell';
model identity(y) = class(a | b);
output replace;
run;
proc print label;
run;
Figure 46: Reference Cell Model, (3,2) Reference Cell
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
19.0000000 |
722.000 |
722.000 |
49.23 |
0.0004 |
Intercept |
| 1 |
-5.0000000 |
25.000 |
25.000 |
1.70 |
0.2395 |
a 1 |
| 1 |
-3.0000000 |
9.000 |
9.000 |
0.61 |
0.4632 |
a 2 |
| 1 |
-8.0000000 |
64.000 |
64.000 |
4.36 |
0.0817 |
b 1 |
| 1 |
9.0000000 |
40.500 |
40.500 |
2.76 |
0.1476 |
a 1 * b 1 |
| 1 |
-3.0000000 |
4.500 |
4.500 |
0.31 |
0.5997 |
a 2 * b 1 |
Figure 47: Reference Cell Model, (3,2) Reference Cell, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
0 |
1 |
1 |
0 |
1 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
0 |
1 |
0 |
0 |
0 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
0 |
1 |
0 |
0 |
0 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
0 |
0 |
1 |
0 |
0 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
0 |
0 |
1 |
0 |
0 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
0 |
0 |
0 |
0 |
0 |
3 |
2 |
The next model is a deviations-from-means model. This coding is also called effects coding. The default reference cell is the last cell (3,2). The following statements produce Figure 48 and Figure 49:
proc transreg data=x ss2 short;
title2 'Deviations from Means, (3,2) Reference Cell';
model identity(y) = class(a | b / deviations);
output replace;
run;
proc print label;
run;
Figure 48: Deviations-from-Means Model, (3,2) Reference Cell
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
13.3333333 |
2133.33 |
2133.33 |
145.45 |
<.0001 |
Intercept |
| 1 |
1.1666667 |
8.17 |
8.17 |
0.56 |
0.4837 |
a 1 |
| 1 |
-2.8333333 |
48.17 |
48.17 |
3.28 |
0.1199 |
a 2 |
| 1 |
-3.0000000 |
108.00 |
108.00 |
7.36 |
0.0349 |
b 1 |
| 1 |
3.5000000 |
73.50 |
73.50 |
5.01 |
0.0665 |
a 1 * b 1 |
| 1 |
-2.5000000 |
37.50 |
37.50 |
2.56 |
0.1609 |
a 2 * b 1 |
Figure 49: Deviations-from-Means Model, (3,2) Reference Cell, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
1 |
0 |
-1 |
-1 |
0 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
1 |
0 |
-1 |
-1 |
0 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
0 |
1 |
1 |
0 |
1 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
0 |
1 |
-1 |
0 |
-1 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
0 |
1 |
-1 |
0 |
-1 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
-1 |
-1 |
1 |
-1 |
-1 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
-1 |
-1 |
1 |
-1 |
-1 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
3 |
2 |
The next model is a less-than-full-rank model. The parameter estimates are constrained to sum to zero within each effect. The following statements produce Figure 50 and Figure 51:
proc transreg data=x ss2 short;
title2 'Less-Than-Full-Rank Model';
model identity(y) = class(a | b / zero=sum);
output replace;
run;
proc print label;
run;
Figure 50: Less-Than-Full-Rank Model
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
13.3333333 |
2133.33 |
2133.33 |
145.45 |
<.0001 |
Intercept |
| 1 |
1.1666667 |
8.17 |
8.17 |
0.56 |
0.4837 |
a 1 |
| 1 |
-2.8333333 |
48.17 |
48.17 |
3.28 |
0.1199 |
a 2 |
| 1 |
1.6666667 |
16.67 |
16.67 |
1.14 |
0.3274 |
a 3 |
| 1 |
-3.0000000 |
108.00 |
108.00 |
7.36 |
0.0349 |
b 1 |
| 1 |
3.0000000 |
108.00 |
108.00 |
7.36 |
0.0349 |
b 2 |
| 1 |
3.5000000 |
73.50 |
73.50 |
5.01 |
0.0665 |
a 1 * b 1 |
| 1 |
-3.5000000 |
73.50 |
73.50 |
5.01 |
0.0665 |
a 1 * b 2 |
| 1 |
-2.5000000 |
37.50 |
37.50 |
2.56 |
0.1609 |
a 2 * b 1 |
| 1 |
2.5000000 |
37.50 |
37.50 |
2.56 |
0.1609 |
a 2 * b 2 |
| 1 |
-1.0000000 |
6.00 |
6.00 |
0.41 |
0.5461 |
a 3 * b 1 |
| 1 |
1.0000000 |
6.00 |
6.00 |
0.41 |
0.5461 |
a 3 * b 2 |
| The sum of the regression table DF's, minus one for the intercept, will be greater than the model df when there are ZERO=SUM constraints. |
Only four of the five interaction constraints are needed. The fifth constraint is implied by the other four. (Given a
table with four marginal sum-to-zero constraints, you can freely fill in only two cells. The values in the other four cells are determined from the first two cells and the constraints.) A full-rank model has six estimable parameters. This less-than-full-rank model has one parameter for the intercept, two for the first main effect (plus one more as determined by the first constraint), one for the second main effect (plus one more as determined by the second constraint), and two for the interactions (plus four more as determined by the next four constraints). Six of the twelve parameters are determined given the other six and the constraints. Notice that
and
match the corresponding estimates from the effects coding.
Figure 51: Less-Than-Full-Rank Model, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
3 |
2 |
The next model is a reference cell model, but this time the reference cell is the first cell (1,1). The following statements produce Figure 52 and Figure 53:
proc transreg data=x ss2 short;
title2 'Reference Cell Model, (1,1) Reference Cell';
model identity(y) = class(a | b / zero=first);
output replace;
run;
proc print label;
run;
Figure 52: Reference Cell Model, (1,1) Reference Cell
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
15.000000 |
450.000 |
450.000 |
30.68 |
0.0015 |
Intercept |
| 1 |
-10.000000 |
100.000 |
100.000 |
6.82 |
0.0401 |
a 2 |
| 1 |
-4.000000 |
16.000 |
16.000 |
1.09 |
0.3365 |
a 3 |
| 1 |
-1.000000 |
1.000 |
1.000 |
0.07 |
0.8027 |
b 2 |
| 1 |
12.000000 |
72.000 |
72.000 |
4.91 |
0.0686 |
a 2 * b 2 |
| 1 |
9.000000 |
40.500 |
40.500 |
2.76 |
0.1476 |
a 3 * b 2 |
Figure 53: Reference Cell Model, (1,1) Reference Cell, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
1 |
0 |
0 |
0 |
0 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
1 |
0 |
1 |
1 |
0 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
1 |
0 |
1 |
1 |
0 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
0 |
1 |
0 |
0 |
0 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
0 |
1 |
0 |
0 |
0 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
0 |
1 |
1 |
0 |
1 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
0 |
1 |
1 |
0 |
1 |
3 |
2 |
The next model is a deviations-from-means model, but this time the reference cell is the first cell (1,1). This coding is also called effects coding. The following statements produce Figure 54 and Figure 55:
proc transreg data=x ss2 short;
title2 'Deviations from Means, (1,1) Reference Cell';
model identity(y) = class(a | b / deviations zero=first);
output replace;
run;
proc print label;
run;
Figure 54: Deviations-from-Means Model, (1,1) Reference Cell
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
13.3333333 |
2133.33 |
2133.33 |
145.45 |
<.0001 |
Intercept |
| 1 |
-2.8333333 |
48.17 |
48.17 |
3.28 |
0.1199 |
a 2 |
| 1 |
1.6666667 |
16.67 |
16.67 |
1.14 |
0.3274 |
a 3 |
| 1 |
3.0000000 |
108.00 |
108.00 |
7.36 |
0.0349 |
b 2 |
| 1 |
2.5000000 |
37.50 |
37.50 |
2.56 |
0.1609 |
a 2 * b 2 |
| 1 |
1.0000000 |
6.00 |
6.00 |
0.41 |
0.5461 |
a 3 * b 2 |
Notice that all of the parameter estimates match the corresponding estimates from the less-than-full-rank coding.
Figure 55: Deviations-from-Means Model, (1,1) Reference Cell, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
-1 |
-1 |
1 |
-1 |
-1 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
-1 |
-1 |
1 |
-1 |
-1 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
1 |
0 |
-1 |
-1 |
0 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
1 |
0 |
-1 |
-1 |
0 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
1 |
0 |
1 |
1 |
0 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
1 |
0 |
1 |
1 |
0 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
0 |
1 |
-1 |
0 |
-1 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
0 |
1 |
-1 |
0 |
-1 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
0 |
1 |
1 |
0 |
1 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
0 |
1 |
1 |
0 |
1 |
3 |
2 |
The following statements fit a model with an orthogonal-contrast coding and produce Figure 56 and Figure 57:
proc transreg data=x ss2 short;
title2 'Orthogonal Contrast Coding';
model identity(y) = class(a | b / orthogonal);
output replace;
run;
proc print label;
run;
Figure 56: Orthogonal-Contrast Coding
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
13.3333333 |
2133.33 |
2133.33 |
145.45 |
<.0001 |
Intercept |
| 1 |
-0.2500000 |
0.50 |
0.50 |
0.03 |
0.8596 |
a 1 |
| 1 |
-1.4166667 |
48.17 |
48.17 |
3.28 |
0.1199 |
a 2 |
| 1 |
-3.0000000 |
108.00 |
108.00 |
7.36 |
0.0349 |
b 1 |
| 1 |
2.2500000 |
40.50 |
40.50 |
2.76 |
0.1476 |
a 1 * b 1 |
| 1 |
-1.2500000 |
37.50 |
37.50 |
2.56 |
0.1609 |
a 2 * b 1 |
Figure 57: Orthogonal-Contrast Coding, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
1 |
-1 |
1 |
1 |
-1 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
1 |
-1 |
1 |
1 |
-1 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
0 |
2 |
1 |
0 |
2 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
0 |
2 |
1 |
0 |
2 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
0 |
2 |
-1 |
0 |
-2 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
0 |
2 |
-1 |
0 |
-2 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
-1 |
-1 |
1 |
-1 |
-1 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
-1 |
-1 |
1 |
-1 |
-1 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
-1 |
-1 |
-1 |
1 |
1 |
3 |
2 |
The following statements fit a model with a standardized-orthogonal coding and produce Figure 58 and Figure 59:
proc transreg data=x ss2 short;
title2 'Standardized-Orthogonal Coding';
model identity(y) = class(a | b / standorth);
output replace;
run;
proc print label;
run;
Figure 58: Standardized-Orthogonal Coding
The TRANSREG Procedure
| Dependent Variable Identity(y) |
| The TRANSREG Procedure Hypothesis Tests for Identity(y) |
| 5 |
234.6667 |
46.93333 |
3.20 |
0.0946 |
| 6 |
88.0000 |
14.66667 |
|
|
| 11 |
322.6667 |
|
|
|
| 3.82971 |
0.7273 |
| 13.33333 |
0.5000 |
| 28.72281 |
|
| 1 |
13.3333333 |
2133.33 |
2133.33 |
145.45 |
<.0001 |
Intercept |
| 1 |
-0.2041241 |
0.50 |
0.50 |
0.03 |
0.8596 |
a 1 |
| 1 |
-2.0034692 |
48.17 |
48.17 |
3.28 |
0.1199 |
a 2 |
| 1 |
-3.0000000 |
108.00 |
108.00 |
7.36 |
0.0349 |
b 1 |
| 1 |
1.8371173 |
40.50 |
40.50 |
2.76 |
0.1476 |
a 1 * b 1 |
| 1 |
-1.7677670 |
37.50 |
37.50 |
2.56 |
0.1609 |
a 2 * b 1 |
The numerators in the square roots are sums of squares of the coded values for the unstandardized-orthogonal codings, and the denominators are the numbers of levels. These terms convert the estimates from the orthogonal contrast coding to the standardized-orthogonal coding. The term
, which is 1 and could be dropped, is included in the preceding formulas to show the general pattern. Notice the regression tables for the orthogonal-contrast coding and the standardized-orthogonal coding. Some of the coefficients are different, but the rest of the table is the same since the coded variables for the two models differ only by a constant.
Figure 59: Standardized-Orthogonal Coding, Design Matrix
| SCORE |
ROW1 |
16 |
1 |
1.22474 |
-0.70711 |
1 |
1.22474 |
-0.70711 |
1 |
1 |
| SCORE |
ROW2 |
14 |
1 |
1.22474 |
-0.70711 |
1 |
1.22474 |
-0.70711 |
1 |
1 |
| SCORE |
ROW3 |
15 |
1 |
1.22474 |
-0.70711 |
-1 |
-1.22474 |
0.70711 |
1 |
2 |
| SCORE |
ROW4 |
13 |
1 |
1.22474 |
-0.70711 |
-1 |
-1.22474 |
0.70711 |
1 |
2 |
| SCORE |
ROW5 |
1 |
1 |
0.00000 |
1.41421 |
1 |
0.00000 |
1.41421 |
2 |
1 |
| SCORE |
ROW6 |
9 |
1 |
0.00000 |
1.41421 |
1 |
0.00000 |
1.41421 |
2 |
1 |
| SCORE |
ROW7 |
12 |
1 |
0.00000 |
1.41421 |
-1 |
0.00000 |
-1.41421 |
2 |
2 |
| SCORE |
ROW8 |
20 |
1 |
0.00000 |
1.41421 |
-1 |
0.00000 |
-1.41421 |
2 |
2 |
| SCORE |
ROW9 |
14 |
1 |
-1.22474 |
-0.70711 |
1 |
-1.22474 |
-0.70711 |
3 |
1 |
| SCORE |
ROW10 |
8 |
1 |
-1.22474 |
-0.70711 |
1 |
-1.22474 |
-0.70711 |
3 |
1 |
| SCORE |
ROW11 |
18 |
1 |
-1.22474 |
-0.70711 |
-1 |
1.22474 |
0.70711 |
3 |
2 |
| SCORE |
ROW12 |
20 |
1 |
-1.22474 |
-0.70711 |
-1 |
1.22474 |
0.70711 |
3 |
2 |