Statistical Graphics Using ODS

Nonlinear Models

The preceding examples all show linear models. The EFFECT statement and the SPLINE effect are available for both linear and nonlinear models. The following procedures provide an EFFECT statement: GEE, GENMOD, GLIMMIX, GLMSELECT, HPMIXED, LOGISTIC, ORTHOREG, PHREG, PLM, PROBIT, QUANTLIFE, QUANTREG, QUANTSELECT, ROBUSTREG, SURVEYLOGISTIC, and SURVEYREG. The following steps show how to use the EFFECT statement in logistic regression:

data Neuralgia;
   input Treatment $ Sex $ Age Duration Pain $ @@;
   datalines;
P  F  68   1  No   B  M  74  16  No   P  F  67  30  No   P  M  66  26  Yes
B  F  67  28  No   B  F  77  16  No   A  F  71  12  No   B  F  72  50  No
B  F  76   9  Yes  A  M  71  17  Yes  A  F  63  27  No   A  F  69  18  Yes
B  F  66  12  No   A  M  62  42  No   P  F  64   1  Yes  A  F  64  17  No
P  M  74   4  No   A  F  72  25  No   P  M  70   1  Yes  B  M  66  19  No
B  M  59  29  No   A  F  64  30  No   A  M  70  28  No   A  M  69   1  No
B  F  78   1  No   P  M  83   1  Yes  B  F  69  42  No   B  M  75  30  Yes
P  M  77  29  Yes  P  F  79  20  Yes  A  M  70  12  No   A  F  69  12  No
B  F  65  14  No   B  M  70   1  No   B  M  67  23  No   A  M  76  25  Yes
P  M  78  12  Yes  B  M  77   1  Yes  B  F  69  24  No   P  M  66   4  Yes
P  F  65  29  No   P  M  60  26  Yes  A  M  78  15  Yes  B  M  75  21  Yes
A  F  67  11  No   P  F  72  27  No   P  F  70  13  Yes  A  M  75   6  Yes
B  F  65   7  No   P  F  68  27  Yes  P  M  68  11  Yes  P  M  67  17  Yes
B  M  70  22  No   A  M  65  15  No   P  F  67   1  Yes  A  M  67  10  No
P  F  72  11  Yes  A  F  74   1  No   B  M  80  21  Yes  A  F  69   3  No
;

proc logistic data=Neuralgia outdesign=coded;
   class Treatment Sex;
   effect Age2      = spline(age / degree=2 knotmethod=equal(0));
   effect Duration2 = polynomial(duration / degree=2);
   model Pain= Treatment Sex Treatment*Sex Age2 Duration2 / expb;
run;

proc print data=coded(obs=10); run;

The parameter estimates are displayed in Output 24.6.32. There are three rows for the variable Age, which is designated as a quadratic spline with no knots (in other words, as a quadratic polynomial). There are three rows and two parameter estimates because the B-spline basis had d plus 1 columns for a polynomial of degree d. The variable Duration is directly specified as a quadratic polynomial, and it has two rows in the table. Output 24.6.33 displays the first 10 coded observations. You can see that Age has values between 0 and 1, which is characteristic of a B-spline basis, and Duration is coded as an ordinary polynomial (duration and duration squared).

Output 24.6.32: Grouped Fit Function, Fit Statistics, and Plot

Analysis of Maximum Likelihood Estimates
Parameter     DF Estimate Standard
Error
Wald
Chi-Square
Pr > ChiSq Exp(Est)
Intercept     1 -22.1944 11.0096 4.0639 0.0438 0.000
Treatment A   1 0.6601 0.6187 1.1381 0.2861 1.935
Treatment B   1 2.0464 0.8893 5.2954 0.0214 7.740
Sex F   1 0.8436 0.4179 4.0736 0.0436 2.325
Treatment*Sex A F 1 -0.2576 0.5914 0.1897 0.6632 0.773
Treatment*Sex B F 1 0.5762 0.7017 0.6743 0.4116 1.779
Age2 1   1 16.8907 6.6152 6.5194 0.0107 21654611
Age2 2   1 29.1886 14.6180 3.9871 0.0459 4.747E12
Age2 3   0 0 . . . .
Duration     1 -0.2274 0.1667 1.8615 0.1724 0.797
Duration^2     1 0.00803 0.00562 2.0431 0.1529 1.008


Output 24.6.33: The First 10 Observations of the OUTDESIGN= Data Set

Obs Pain Intercept TreatmentA TreatmentB SexF TreatmentASexF TreatmentBSexF Age21 Age22 Age23 Duration Duration_2
1 No 1 -1 -1 1 -1 -1 0.19531 0.73437 0.07031 1 1
2 No 1 0 1 -1 0 -1 0.07031 0.73437 0.19531 16 256
3 No 1 -1 -1 1 -1 -1 0.22222 0.72222 0.05556 30 900
4 Yes 1 -1 -1 -1 1 1 0.25087 0.70660 0.04253 26 676
5 No 1 0 1 1 0 1 0.22222 0.72222 0.05556 28 784
6 No 1 0 1 1 0 1 0.03125 0.68750 0.28125 16 256
7 No 1 1 0 1 1 0 0.12500 0.75000 0.12500 12 144
8 No 1 0 1 1 0 1 0.10503 0.74826 0.14670 50 2500
9 Yes 1 0 1 1 0 1 0.04253 0.70660 0.25087 9 81
10 Yes 1 1 0 -1 -1 0 0.12500 0.75000 0.12500 17 289


Last updated: December 09, 2022