The CATMOD Procedure

Example 32.3 Logistic Regression, Standard Response Function

(View the complete code for this example.)

In this data set, from Cox and Snell (1989), ingots are prepared with different heating and soaking times and tested for their readiness to be rolled. The following DATA step creates a response variable Y with value 1 for ingots that are not ready and value 0 otherwise. The explanatory variables are Heat and Soak.

data ingots;
   input Heat Soak nready ntotal @@;
   Count=nready;
   Y=1;
   output;
   Count=ntotal-nready;
   Y=0;
   output;
   drop nready ntotal;
   datalines;
7 1.0 0 10   14 1.0 0 31   27 1.0 1 56   51 1.0 3 13
7 1.7 0 17   14 1.7 0 43   27 1.7 4 44   51 1.7 0  1
7 2.2 0  7   14 2.2 2 33   27 2.2 0 21   51 2.2 0  1
7 2.8 0 12   14 2.8 0 31   27 2.8 1 22   51 4.0 0  1
7 4.0 0  9   14 4.0 0 19   27 4.0 1 16
;

Logistic regression analysis is often used to investigate the relationship between discrete response variables and continuous explanatory variables. For logistic regression, the continuous design-effects are declared in a DIRECT statement. The following statements produce Output 32.3.1 through Output 32.3.6:

title 'Maximum Likelihood Logistic Regression';
proc catmod data=ingots;
   weight Count;
   direct Heat Soak;
   model Y=Heat Soak / freq covb corrb itprint design;
quit;

You can verify that the populations are defined as you intended by looking at the "Population Profiles" table in Output 32.3.1.

Output 32.3.1: Maximum Likelihood Logistic Regression

Maximum Likelihood Logistic Regression

The CATMOD Procedure

Data Summary
ResponseYResponse Levels2
Weight VariableCountPopulations19
Data SetINGOTSTotal Frequency387
Frequency Missing0Observations25

Population Profiles
SampleHeatSoakSample Size
17110
271.717
372.27
472.812
5749
614131
7141.743
8142.233
9142.831
1014419
1127156
12271.744
13272.221
14272.822
1527416
1651113
17511.71
18512.21
195141


Since the "Response Profiles" table in Output 32.3.2 shows the response level ordering as 0, 1, the default response function, the logit, is defined as .

Output 32.3.2: Response Summaries

Response Profiles
ResponseY
10
21

Response Frequencies
SampleResponse Number
12
1100
2170
370
4120
590
6310
7430
8312
9310
10190
11551
12404
13210
14211
15151
16103
1710
1810
1910


The values of the continuous variable are inserted into the design matrix (Output 32.3.3).

Output 32.3.3: Design Matrix

Response Functions and Design Matrix
SampleResponse
Function
Design Matrix
1 2 3
12.99573171
23.52636171.7
32.63906172.2
43.17805172.8
52.89037174
64.127131141
74.454351141.7
82.740841142.2
94.127131142.8
103.637591144
114.007331271
122.302591271.7
133.737671272.2
143.044521272.8
152.708051274
161.203971511
170.693151511.7
180.693151512.2
190.693151514


Seven Newton-Raphson iterations are required to find the maximum likelihood estimates (Output 32.3.4).

Output 32.3.4: Iteration History

Maximum Likelihood Analysis
IterationSub Iteration-2 Log
Likelihood
Convergence CriterionParameter Estimates
1 2 3
00536.495921.0000000
10152.589610.71562.1594-0.0139-0.003733
20106.760660.30033.5334-0.0363-0.0120
3096.6921710.09434.7489-0.0640-0.0299
4095.3838250.01355.4138-0.0790-0.0498
5095.3456590.0004005.5539-0.0819-0.0564
6095.3456134.8289E-75.5592-0.0820-0.0568
7095.3456137.728E-135.5592-0.0820-0.0568

Maximum likelihood computations converged.


The analysis of variance table (Output 32.3.5) shows that the model fits since the likelihood ratio goodness-of-fit test is nonsignificant. It also shows that the length of heating time is a significant factor with respect to readiness but that length of soaking time is not.

Output 32.3.5: Analysis of Variance Table

Maximum Likelihood Analysis of Variance
SourceDF Chi-SquarePr > ChiSq
Intercept124.65<.0001
Heat111.950.0005
Soak10.030.8639
Likelihood Ratio1613.750.6171


From the table of maximum likelihood estimates in Output 32.3.6, the fitted model is

For example, for Sample 1 with Heat = 7 and Soak = 1, the estimate is

Output 32.3.6: Maximum Likelihood Estimates, Covariances, and Correlations

Analysis of Maximum Likelihood Estimates
ParameterEstimate Standard
Error
Chi-
Square
Pr > ChiSq
Intercept5.55921.119724.65<.0001
Heat-0.08200.023711.950.0005
Soak-0.05680.33120.030.8639

Covariance Matrix of the Maximum Likelihood Estimates
RowParameterCol1Col2Col3
1Intercept1.2537133-0.0215664-0.2817648
2Heat-0.02156640.00056330.0026243
3Soak-0.28176480.00262430.1097020

Correlation Matrix of the Maximum Likelihood Estimates
RowParameterCol1Col2Col3
1Intercept1.00000-0.81152-0.75977
2Heat-0.811521.000000.33383
3Soak-0.759770.333831.00000


Predicted values of the logits, as well as the probabilities of readiness, could be obtained by specifying PRED=PROB in the MODEL statement. For the example of Sample 1 with Heat = 7 and Soak = 1, PRED=PROB would give an estimate of the probability of readiness equal to 0.9928 since

implies that

As another consideration, since soaking time is nonsignificant, you could fit another model that deleted the variable Soak.