Using the DESIGN Output Option
This example uses PROC TRANSREG and the DESIGN o-option to prepare
an input data set with classification variables for the LOGISTIC
procedure. The
DESIGN o-option specifies that the goal is design matrix creation,
not analysis. When you specify DESIGN, dependent variables are not
required. The DEVIATIONS (or EFFECTS) t-option requests a
deviations-from-means (1, 0, -1) coding of the classification
variables, which is the same coding the CATMOD procedure uses. See
Figure 65.29. PROC TRANSREG automatically creates a macro variable
&_trgind that contains the list of independent variables created.
This macro is used in the PROC LOGISTIC MODEL statement. See
Figure 65.30.
For comparison, the same analysis is also performed
with PROC CATMOD. See Figure 65.31.
title 'Using PROC TRANSREG to Create a Design Matrix';
data a;
do y = 1, 2;
do a = 1 to 4;
do b = 1 to 3;
w = ceil(uniform(1) * 10 + 10);
output;
end;
end;
end;
run;
proc transreg data=a design;
model class(a b / deviations);
id y w;
output;
run;
proc print;
title2 'PROC TRANSREG Output Data Set';
run;
proc logistic;
title2 'PROC LOGISTIC with Classification Variables';
freq w;
model y = &_trgind;
run;
proc catmod data=a;
title2 'PROC CATMOD Should Produce the Same Results';
model y = a b;
weight w;
run;
Using PROC TRANSREG to Create a Design Matrix |
PROC TRANSREG Output Data Set |
Obs |
_TYPE_ |
_NAME_ |
Intercept |
a1 |
a2 |
a3 |
b1 |
b2 |
a |
b |
y |
w |
1 |
SCORE |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
1 |
12 |
2 |
SCORE |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
2 |
1 |
20 |
3 |
SCORE |
1 |
1 |
1 |
0 |
0 |
-1 |
-1 |
1 |
3 |
1 |
14 |
4 |
SCORE |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
2 |
1 |
1 |
13 |
5 |
SCORE |
1 |
1 |
0 |
1 |
0 |
0 |
1 |
2 |
2 |
1 |
20 |
6 |
SCORE |
1 |
1 |
0 |
1 |
0 |
-1 |
-1 |
2 |
3 |
1 |
20 |
7 |
SCORE |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
3 |
1 |
1 |
16 |
8 |
SCORE |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
3 |
2 |
1 |
16 |
9 |
SCORE |
1 |
1 |
0 |
0 |
1 |
-1 |
-1 |
3 |
3 |
1 |
11 |
10 |
SCORE |
1 |
1 |
-1 |
-1 |
-1 |
1 |
0 |
4 |
1 |
1 |
11 |
11 |
SCORE |
1 |
1 |
-1 |
-1 |
-1 |
0 |
1 |
4 |
2 |
1 |
19 |
12 |
SCORE |
1 |
1 |
-1 |
-1 |
-1 |
-1 |
-1 |
4 |
3 |
1 |
16 |
13 |
SCORE |
2 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
2 |
19 |
14 |
SCORE |
2 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
2 |
2 |
11 |
15 |
SCORE |
2 |
1 |
1 |
0 |
0 |
-1 |
-1 |
1 |
3 |
2 |
20 |
16 |
SCORE |
2 |
1 |
0 |
1 |
0 |
1 |
0 |
2 |
1 |
2 |
13 |
17 |
SCORE |
2 |
1 |
0 |
1 |
0 |
0 |
1 |
2 |
2 |
2 |
13 |
18 |
SCORE |
2 |
1 |
0 |
1 |
0 |
-1 |
-1 |
2 |
3 |
2 |
17 |
19 |
SCORE |
2 |
1 |
0 |
0 |
1 |
1 |
0 |
3 |
1 |
2 |
20 |
20 |
SCORE |
2 |
1 |
0 |
0 |
1 |
0 |
1 |
3 |
2 |
2 |
13 |
21 |
SCORE |
2 |
1 |
0 |
0 |
1 |
-1 |
-1 |
3 |
3 |
2 |
17 |
22 |
SCORE |
2 |
1 |
-1 |
-1 |
-1 |
1 |
0 |
4 |
1 |
2 |
15 |
23 |
SCORE |
2 |
1 |
-1 |
-1 |
-1 |
0 |
1 |
4 |
2 |
2 |
16 |
24 |
SCORE |
2 |
1 |
-1 |
-1 |
-1 |
-1 |
-1 |
4 |
3 |
2 |
13 |
|
Figure 65.29: The PROC TRANSREG Design Matrix
Using PROC TRANSREG to Create a Design Matrix |
PROC LOGISTIC with Classification Variables |
Model Information |
Data Set |
WORK.DATA8 |
Response Variable |
y |
Number of Response Levels |
2 |
Number of Observations |
24 |
Frequency Variable |
w |
Sum of Frequencies |
375 |
Link Function |
Logit |
Optimization Technique |
Fisher's scoring |
Response Profile |
Ordered Value |
y |
Total Frequency |
1 |
1 |
188 |
2 |
2 |
187 |
Model Convergence Status |
Convergence criterion (GCONV=1E-8) satisfied. |
Model Fit Statistics |
Criterion |
Intercept Only |
Intercept and Covariates |
AIC |
521.858 |
524.378 |
SC |
525.785 |
547.939 |
-2 Log L |
519.858 |
512.378 |
Testing Global Null Hypothesis: BETA=0 |
Test |
Chi-Square |
DF |
Pr > ChiSq |
Likelihood Ratio |
7.4799 |
5 |
0.1873 |
Score |
7.4312 |
5 |
0.1905 |
Wald |
7.3356 |
5 |
0.1969 |
|
Figure 65.30: PROC LOGISTIC Output
Using PROC TRANSREG to Create a Design Matrix |
PROC LOGISTIC with Classification Variables |
Analysis of Maximum Likelihood Estimates |
Parameter |
DF |
Estimate |
Standard Error |
Chi-Square |
Pr > ChiSq |
Intercept |
1 |
-0.00040 |
0.1044 |
0.0000 |
0.9969 |
a1 |
1 |
-0.0802 |
0.1791 |
0.2007 |
0.6542 |
a2 |
1 |
0.2001 |
0.1800 |
1.2363 |
0.2662 |
a3 |
1 |
-0.1350 |
0.1819 |
0.5514 |
0.4578 |
b1 |
1 |
-0.2392 |
0.1500 |
2.5436 |
0.1107 |
b2 |
1 |
0.3433 |
0.1474 |
5.4223 |
0.0199 |
Association of Predicted Probabilities and Observed Responses |
Percent Concordant |
54.0 |
Somers' D |
0.163 |
Percent Discordant |
37.8 |
Gamma |
0.177 |
Percent Tied |
8.2 |
Tau-a |
0.082 |
Pairs |
35156 |
c |
0.581 |
|
Using PROC TRANSREG to Create a Design Matrix |
PROC CATMOD Should Produce the Same Results |
Response |
y |
Response Levels |
2 |
Weight Variable |
w |
Populations |
12 |
Data Set |
A |
Total Frequency |
375 |
Frequency Missing |
0 |
Observations |
24 |
Population Profiles |
Sample |
a |
b |
Sample Size |
1 |
1 |
1 |
31 |
2 |
1 |
2 |
31 |
3 |
1 |
3 |
34 |
4 |
2 |
1 |
26 |
5 |
2 |
2 |
33 |
6 |
2 |
3 |
37 |
7 |
3 |
1 |
36 |
8 |
3 |
2 |
29 |
9 |
3 |
3 |
28 |
10 |
4 |
1 |
26 |
11 |
4 |
2 |
35 |
12 |
4 |
3 |
29 |
Response Profiles |
Response |
y |
1 |
1 |
2 |
2 |
|
Figure 65.31: PROC CATMOD Output
Using PROC TRANSREG to Create a Design Matrix |
PROC CATMOD Should Produce the Same Results |
Maximum Likelihood Analysis |
Iteration |
Sub Iteration |
-2 Log Likelihood |
Convergence Criterion |
Parameter Estimates |
1 |
2 |
3 |
4 |
5 |
6 |
0 |
0 |
519.86039 |
1.0000 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
512.3792 |
0.0144 |
-0.001162 |
-0.0790 |
0.1965 |
-0.1327 |
-0.2365 |
0.3393 |
2 |
0 |
512.37786 |
2.608E-6 |
-0.000404 |
-0.0802 |
0.2001 |
-0.1350 |
-0.2392 |
0.3433 |
3 |
0 |
512.37786 |
9.929E-13 |
-0.000403 |
-0.0802 |
0.2001 |
-0.1350 |
-0.2392 |
0.3434 |
Maximum likelihood computations converged. |
Maximum Likelihood Analysis of Variance |
Source |
DF |
Chi-Square |
Pr > ChiSq |
Intercept |
1 |
0.00 |
0.9969 |
a |
3 |
1.50 |
0.6823 |
b |
2 |
5.64 |
0.0597 |
Likelihood Ratio |
6 |
2.81 |
0.8329 |
Analysis of Maximum Likelihood Estimates |
Effect |
Parameter |
Estimate |
Standard Error |
Chi- Square |
Pr > ChiSq |
Intercept |
1 |
-0.00040 |
0.1044 |
0.00 |
0.9969 |
a |
2 |
-0.0802 |
0.1791 |
0.20 |
0.6542 |
|
3 |
0.2001 |
0.1800 |
1.24 |
0.2662 |
|
4 |
-0.1350 |
0.1819 |
0.55 |
0.4578 |
b |
5 |
-0.2392 |
0.1500 |
2.54 |
0.1107 |
|
6 |
0.3434 |
0.1474 |
5.42 |
0.0199 |
|
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.