Main-Effects ANOVA
This example shows how to use the TRANSREG procedure
to code and fit a main-effects ANOVA model.
The input data set
contains the dependent variables
Y, factors X1 and X2,
and 11 observations.
The following statements
perform a main-effects ANOVA:
title 'Introductory Main-Effects ANOVA Example';
data A;
input Y X1 $ X2 $;
datalines;
8 a a
7 a a
4 a b
3 a b
5 b a
4 b a
2 b b
1 b b
8 c a
7 c a
5 c b
2 c b
;
*---Fit a Main-Effects ANOVA model with 1, 0, -1 coding. ---;
proc transreg ss2;
model identity(Y) = class(X1 X2 / effects);
output coefficients replace;
run;
*---Print TRANSREG output data set---;
proc print label;
format Intercept -- X2a 5.2;
run;
Introductory Main-Effects ANOVA Example |
TRANSREG Univariate Algorithm Iteration History for Identity(Y) |
Iteration Number |
Average Change |
Maximum Change |
R-Square |
Criterion Change |
Note |
1 |
0.00000 |
0.00000 |
0.88144 |
|
Converged |
The TRANSREG Procedure Hypothesis Tests for Identity(Y) |
Univariate ANOVA Table Based on the Usual Degrees of Freedom |
Source |
DF |
Sum of Squares |
Mean Square |
F Value |
Pr > F |
Model |
3 |
57.00000 |
19.00000 |
19.83 |
0.0005 |
Error |
8 |
7.66667 |
0.95833 |
|
|
Corrected Total |
11 |
64.66667 |
|
|
|
Root MSE |
0.97895 |
R-Square |
0.8814 |
Dependent Mean |
4.66667 |
Adj R-Sq |
0.8370 |
Coeff Var |
20.97739 |
|
|
Univariate Regression Table Based on the Usual Degrees of Freedom |
Variable |
DF |
Coefficient |
Type II Sum of Squares |
Mean Square |
F Value |
Pr > F |
Label |
Intercept |
1 |
4.6666667 |
261.333 |
261.333 |
272.70 |
<.0001 |
Intercept |
Class.X1a |
1 |
0.8333333 |
4.167 |
4.167 |
4.35 |
0.0705 |
X1 a |
Class.X1b |
1 |
-1.6666667 |
16.667 |
16.667 |
17.39 |
0.0031 |
X1 b |
Class.X2a |
1 |
1.8333333 |
40.333 |
40.333 |
42.09 |
0.0002 |
X2 a |
|
Figure 65.1: ANOVA Example Output from PROC TRANSREG
The iteration history in Figure 65.1 shows that the final R-Square
of 0.88144 is reached on the first iteration.
This is followed by ANOVA, fit statistics, and regression tables.
PROC TRANSREG uses an
effects (also called deviations from means or 0, 1, -1) coding
in this example.
The TRANSREG procedure produces the data set
displayed in Figure 65.2.
Introductory Main-Effects ANOVA Example |
Obs |
_TYPE_ |
_NAME_ |
Y |
Intercept |
X1 a |
X1 b |
X2 a |
X1 |
X2 |
1 |
SCORE |
ROW1 |
8 |
1.00 |
1.00 |
0.00 |
1.00 |
a |
a |
2 |
SCORE |
ROW2 |
7 |
1.00 |
1.00 |
0.00 |
1.00 |
a |
a |
3 |
SCORE |
ROW3 |
4 |
1.00 |
1.00 |
0.00 |
-1.00 |
a |
b |
4 |
SCORE |
ROW4 |
3 |
1.00 |
1.00 |
0.00 |
-1.00 |
a |
b |
5 |
SCORE |
ROW5 |
5 |
1.00 |
0.00 |
1.00 |
1.00 |
b |
a |
6 |
SCORE |
ROW6 |
4 |
1.00 |
0.00 |
1.00 |
1.00 |
b |
a |
7 |
SCORE |
ROW7 |
2 |
1.00 |
0.00 |
1.00 |
-1.00 |
b |
b |
8 |
SCORE |
ROW8 |
1 |
1.00 |
0.00 |
1.00 |
-1.00 |
b |
b |
9 |
SCORE |
ROW9 |
8 |
1.00 |
-1.00 |
-1.00 |
1.00 |
c |
a |
10 |
SCORE |
ROW10 |
7 |
1.00 |
-1.00 |
-1.00 |
1.00 |
c |
a |
11 |
SCORE |
ROW11 |
5 |
1.00 |
-1.00 |
-1.00 |
-1.00 |
c |
b |
12 |
SCORE |
ROW12 |
2 |
1.00 |
-1.00 |
-1.00 |
-1.00 |
c |
b |
13 |
M COEFFI |
Y |
. |
4.67 |
0.83 |
-1.67 |
1.83 |
|
|
14 |
MEAN |
Y |
. |
. |
5.50 |
3.00 |
6.50 |
|
|
|
Figure 65.2: Output Data Set from PROC TRANSREG
The output data set has three kinds of
observations, identified by values of _TYPE_.
- When _TYPE_='SCORE', the observation contains information
on the dependent and independent variables as follows:
- Y is the original dependent variable.
- X1 and X2 are the independent classification
variables, and the Intercept through X2 a columns
contain the main effects design matrix that PROC TRANSREG
creates. The variable names are Intercept, X1a,
X1b, and X2a. Their labels are shown in the
listing.
- When _TYPE_='M COEFFI', the observation
contains coefficients of the final linear model.
- When _TYPE_='MEAN', the observation
contains the marginal means.
The observations with _TYPE_='SCORE' form the score partition of the
data set, and the observations with _TYPE_='M COEFFI' and
_TYPE_='MEAN' form the coefficient partition of the data set.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.