1 *************************************************************;
2 *** EXST7034 Homework Example 1 ***;
3 *** Problem from Neter, Wasserman & Kuttner 1989, #11.16 ***;
4 *************************************************************;
5 OPTIONS LS=82 PS=61 NOCENTER NODATE NONUMBER;
6
7 DATA ONE; INFILE CARDS MISSOVER;
8
TITLE1 'EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass';
9 * LABEL X1 = 'Age (years)';
10 * LABEL X2 = '(X1-60)*Indicator of Age';
11 * LABEL X3 = 'Indicator of Age > 60';
12 * LABEL Y = 'Muscle mass';
13 INPUT Y X1;
14 X3 = 0; IF X1 GE 60 THEN X3 = 1;
15 X2 = (X1-60)*X3;
16 X1X3 = X1*X3;
17 CARDS;
NOTE: The data set WORK.ONE has 16 observations and 5 variables.
NOTE: DATA statement used:
real time 0.11 seconds
17 ! RUN;
34 ;
35 PROC SORT DATA=ONE; BY X1; RUN;
NOTE: There were 16 observations read from the data set WORK.ONE.
NOTE: The data set WORK.ONE has 16 observations and 5 variables.
NOTE: PROCEDURE SORT used:
real time 0.04 seconds
36 PROC PRINT DATA=ONE; RUN;
NOTE: There were 16 observations read from the data set WORK.ONE.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used:
real time 0.05 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Obs Y X1 X3 X2 X1X3
1 100 43 0 0 0
2 116 45 0 0 0
3 97 45 0 0 0
4 105 49 0 0 0
5 100 53 0 0 0
6 87 56 0 0 0
7 80 56 0 0 0
8 76 58 0 0 0
9 91 64 1 4 64
10 84 65 1 5 65
11 68 67 1 7 67
12 78 68 1 8 68
13 82 71 1 11 71
14 73 73 1 13 73
15 65 76 1 16 76
16 77 78 1 18 78
37 proc plot data=one; plot Y*X1; run;
NOTE: There were 16 observations read from the data set WORK.ONE.
NOTE: The PROCEDURE PLOT printed page 2.
NOTE: PROCEDURE PLOT used:
real time 0.00 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Plot of Y*X1. Legend: A = 1 obs, B = 2 obs, etc.
Y |
|
120 +
|
|
| A
115 +
|
|
|
110 +
|
|
|
105 + A
|
|
|
100 + A A
|
| A
|
95 +
|
|
| A
90 +
|
| A
|
85 +
| A
| A
|
80 + A
|
| A A
| A
75 +
|
| A
|
70 +
|
| A
|
65 + A
|
---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--
43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79
X1
38 PROC REG; TITLE2 'Piecewise regression with SAS REG procedure';
39 TITLE3 'Level adjustment included';
40 MODEL Y = X1 X2 X3; RUN;
NOTE: 16 observations read.
NOTE: 16 observations used in computations.
NOTE: The PROCEDURE REG printed page 3.
NOTE: PROCEDURE REG used:
real time 0.16 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piecewise regression with SAS REG procedure
Level adjustment included
The REG Procedure
Model: MODEL1
Dependent Variable: Y
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 3 2226.68272 742.22757 11.03 0.0009
Error 12 807.75478 67.31290
Corrected Total 15 3034.43750
Root MSE 8.20444 R-Square 0.7338
Dependent Mean 86.18750 Adj R-Sq 0.6673
Coeff Var 9.51930
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 186.30233 26.86367 6.94 <.0001
X1 1 -1.80103 0.52754 -3.41 0.0051
X2 1 0.85553 0.80320 1.07 0.3078
X3 1 8.70111 8.93463 0.97 0.3493
41 PROC REG; TITLE2 'Piecewise regression with SAS REG procedure';
42 TITLE3 'Level adjustment NOT included';
43 MODEL Y = X1 X2; RUN;
NOTE: 16 observations read.
NOTE: 16 observations used in computations.
NOTE: The PROCEDURE REG printed page 4.
NOTE: PROCEDURE REG used:
real time 0.00 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piecewise regression with SAS REG procedure
Level adjustment NOT included
The REG Procedure
Model: MODEL1
Dependent Variable: Y
Analysis of Variance
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 2 2162.84260 1081.42130 16.13 0.0003
Error 13 871.59490 67.04576
Corrected Total 15 3034.43750
Root MSE 8.18815 R-Square 0.7128
Dependent Mean 86.18750 Adj R-Sq 0.6686
Coeff Var 9.50039
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 172.82270 22.97757 7.52 <.0001
X1 1 -1.51665 0.43847 -3.46 0.0042
X2 1 0.98098 0.79122 1.24 0.2370
45 PROC NLIN DATA=ONE MAXITER=200;
46 TITLE2 'Piece wise regression where join-point is unknown';
47 PARAMETERS B0 = 172.8 b1=-1.52 b2=0.981 xvalue = 60;
48 x2 = 0; if x1 gt xvalue then x2=1;
49 MODEL Y = b0 + b1*x1 + b2*(x1-xvalue)*x2;
50 RUN;
NOTE: DER.B0 not initialized or missing. It will be computed automatically.
NOTE: DER.b1 not initialized or missing. It will be computed automatically.
NOTE: DER.b2 not initialized or missing. It will be computed automatically.
NOTE: DER.xvalue not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
WARNING: PROC NLIN failed to converge.
NOTE: The PROCEDURE NLIN printed pages 5-7.
NOTE: PROCEDURE NLIN used:
real time 0.04 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piece wise regression where join-point is unknown
The NLIN Procedure
Dependent Variable Y
Method: Gauss-Newton
Iterative Phase
Sum of
Iter B0 b1 b2 xvalue Squares
0 172.8 -1.5200 0.9810 60.0000 872.4
1 179.6 -1.6605 0.9183 55.5652 869.7
2 172.9 -1.5135 0.7965 57.5730 856.6
3 173.0 -1.5160 0.8384 58.2299 854.3
. . .
51 174.3 -1.5449 0.8792 58.0000 849.7
52 174.3 -1.5449 0.8792 58.0000 849.7
WARNING: Step size shows no improvement.
WARNING: PROC NLIN failed to converge.
Estimation Summary (Not Converged)
Method Gauss-Newton
Iterations 52
Subiterations 163
Average Subiterations 3.134615
R 0.106711
PPC(b2) 0.16296
RPC .
Object 1.43E-13
Objective 849.6886
Observations Read 16
Observations Used 16
Observations Missing 0
Sum of Mean Approx
Source DF Squares Square F Value Pr > F
Regression 4 121037 30259.3 10.28 0.0012
Residual 12 849.7 70.8074
Uncorrected Total 16 121887
Corrected Total 15 3034.4
Approx
Parameter Estimate Std Error Approximate 95% Confidence Limits
B0 174.3 31.2778 106.2 242.5
b1 -1.5449 0.6277 -2.9125 -0.1773
b2 0.8792 0.7858 -0.8329 2.5913
xvalue 58.0000 9.6824 36.9038 79.0962
Approximate Correlation Matrix
B0 b1 b2 xvalue
B0 1.0000000 -0.9948167 0.7946792 -0.5802775
b1 -0.9948167 1.0000000 -0.7988197 0.6214894
b2 0.7946792 -0.7988197 1.0000000 -0.1327208
xvalue -0.5802775 0.6214894 -0.1327208 1.0000000
51 PROC NLIN DATA=ONE MAXITER=200 METHOD=MARQUARDT;
* Methods: GAUSS | MARQUARDT | NEWTON | GRADIENT | DUD ;
52 TITLE2 'Piece wise regression where join-point is unknown';
53 PARAMETERS B0 = 172.8 b1=-1.52 b2=0.981 xvalue = 60;
54 x2 = 0; if x1 gt xvalue then x2=1;
55 MODEL Y = b0 + b1*x1 + b2*(x1-xvalue)*x2;
56 RUN;
NOTE: DER.B0 not initialized or missing. It will be computed automatically.
NOTE: DER.b1 not initialized or missing. It will be computed automatically.
NOTE: DER.b2 not initialized or missing. It will be computed automatically.
NOTE: DER.xvalue not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
WARNING: PROC NLIN failed to converge.
NOTE: The PROCEDURE NLIN printed pages 8-9.
NOTE: PROCEDURE NLIN used:
real time 0.00 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piece wise regression where join-point is unknown
The NLIN Procedure
Dependent Variable Y
Method: Marquardt
Iterative Phase
Sum of
Iter B0 b1 b2 xvalue Squares
0 172.8 -1.5200 0.9810 60.0000 872.4
1 172.8 -1.5248 0.8858 57.8779 850.2
2 172.8 -1.5247 0.8863 57.9153 849.9
3 172.8 -1.5246 0.8870 57.9602 849.6
4 172.8 -1.5244 0.8880 58.0139 849.5
. . .
27 172.8 -1.5244 0.8881 58.0000 849.3
28 172.8 -1.5244 0.8881 58.0000 849.3
29 172.8 -1.5244 0.8881 58.0000 849.3
WARNING: Step size shows no improvement.
WARNING: PROC NLIN failed to converge.
Estimation Summary (Not Converged)
Method Marquardt
Iterations 29
Subiterations 165
Average Subiterations 5.689655
R 0.104617
PPC(b2) 0.151255
RPC .
Object 8.03E-16
Objective 849.3083
Observations Read 16
Observations Used 16
Observations Missing 0
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piece wise regression where join-point is unknown
The NLIN Procedure
Sum of Mean Approx
Source DF Squares Square F Value Pr > F
Regression 4 121038 30259.4 10.29 0.0012
Residual 12 849.3 70.7757
Uncorrected Total 16 121887
Corrected Total 15 3034.4
Approx
Parameter Estimate Std Error Approximate 95% Confidence Limits
B0 172.8 31.2708 104.7 240.9
b1 -1.5244 0.6276 -2.8917 -0.1571
b2 0.8881 0.7856 -0.8235 2.5998
xvalue 58.0000 9.5828 37.1208 78.8792
Approximate Correlation Matrix
B0 b1 b2 xvalue
B0 1.0000000 -0.9948167 0.7946792 -0.5802775
b1 -0.9948167 1.0000000 -0.7988197 0.6214894
b2 0.7946792 -0.7988197 1.0000000 -0.1327208
xvalue -0.5802775 0.6214894 -0.1327208 1.0000000
57 PROC NLIN DATA=ONE MAXITER=200 METHOD=NEWTON;
58 TITLE2 'Piece wise regression where join-point is unknown';
59 PARAMETERS B0 = 172.8 b1=-1.52 b2=0.981 xvalue = 60;
60 x2 = 0; if x1 gt xvalue then x2=1;
61 MODEL Y = b0 + b1*x1 + b2*(x1-xvalue)*x2;
62 RUN;
NOTE: DER.B0 not initialized or missing. It will be computed automatically.
NOTE: DER.b1 not initialized or missing. It will be computed automatically.
NOTE: DER.b2 not initialized or missing. It will be computed automatically.
NOTE: DER.xvalue not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
WARNING: PROC NLIN failed to converge.
NOTE: The PROCEDURE NLIN printed pages 10-11.
NOTE: PROCEDURE NLIN used:
real time 0.00 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piece wise regression where join-point is unknown
The NLIN Procedure
Dependent Variable Y
Method: Newton
Iterative Phase
Sum of
Iter B0 b1 b2 xvalue Squares
0 172.8 -1.5200 0.9810 60.0000 872.4
1 186.1 -1.7908 1.2431 56.4388 866.0
2 184.8 -1.7583 1.3009 58.1663 855.8
3 185.3 -1.7715 1.2363 57.2498 854.8
. . .
26 181.2 -1.6865 1.1413 58.0000 846.7
27 181.2 -1.6865 1.1413 58.0000 846.7
WARNING: Step size shows no improvement.
WARNING: PROC NLIN failed to converge.
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piece wise regression where join-point is unknown
The NLIN Procedure
Estimation Summary (Not Converged)
Method Newton
Iterations 27
Subiterations 104
Average Subiterations 3.851852
R 0.191664
PPC(b1) 0.114274
RPC .
Object 5.37E-16
Objective 846.7078
Observations Read 16
Observations Used 16
Observations Missing 0
Sum of Mean Approx
Source DF Squares Square F Value Pr > F
Regression 4 121040 30260.1 10.34 0.0012
Residual 12 846.7 70.5590
Uncorrected Total 16 121887
Corrected Total 15 3034.4
Approx
Parameter Estimate Std Error Approximate 95% Confidence Limits
B0 181.2 31.0976 113.5 249.0
b1 -1.6865 0.6166 -3.0299 -0.3431
b2 1.1413 0.7778 -0.5533 2.8358
xvalue 58.0000 7.9145 40.7557 75.2443
Approximate Correlation Matrix
B0 b1 b2 xvalue
B0 1.0000000 -0.9954024 0.7424834 -0.5756454
b1 -0.9954024 1.0000000 -0.7507783 0.6050888
b2 0.7424834 -0.7507783 1.0000000 -0.0273950
xvalue -0.5756454 0.6050888 -0.0273950 1.0000000
63 PROC NLIN DATA=ONE MAXITER=32000 METHOD=GRADIENT;
* Methods: GAUSS | MARQUARDT | NEWTON | GRADIENT | DUD ;
64 TITLE2 'Piece wise regression where join-point is unknown';
65 PARAMETERS B0 = 172.8 b1=-1.52 b2=0.981 xvalue = 60;
66 x2 = 0; if x1 gt xvalue then x2=1;
67 MODEL Y = b0 + b1*x1 + b2*(x1-xvalue)*x2;
68 RUN;
NOTE: DER.B0 not initialized or missing. It will be computed automatically.
NOTE: DER.b1 not initialized or missing. It will be computed automatically.
NOTE: DER.b2 not initialized or missing. It will be computed automatically.
NOTE: DER.xvalue not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
WARNING: PROC NLIN failed to converge.
NOTE: The PROCEDURE NLIN printed pages 12-206.
NOTE: PROCEDURE NLIN used:
real time 1.31 seconds
EXST7034 - Homework Example NWK 11.16 (based on # 1.27) : Muscle mass
Piece wise regression where join-point is unknown
The NLIN Procedure
Dependent Variable Y
Method: Gradient
Iterative Phase
Sum of
Iter B0 b1 b2 xvalue Squares
0 172.8 -1.5200 0.9810 60.0000 872.4
1 172.8 -1.5132 0.9817 59.9997 872.2
2 172.8 -1.5168 0.9813 59.9996 871.6
3 172.8 -1.5161 0.9814 59.9994 871.6
4 172.8 -1.5165 0.9813 59.9992 871.6
. . .
9480 172.9 -1.5269 0.8972 58.0000 849.1
9481 172.9 -1.5269 0.8972 58.0000 849.1
9482 172.9 -1.5269 0.8972 58.0000 849.1
WARNING: Step size shows no improvement.
WARNING: PROC NLIN failed to converge.
Estimation Summary (Not Converged)
Method Gradient
Iterations 9482
Subiterations 22062
Average Subiterations 2.326724
R 0.146898
PPC(b2) 0.185486
RPC .
Object 1.61E-15
Objective 849.0904
Observations Read 16
Observations Used 16
Observations Missing 0
Sum of Mean Approx
Source DF Squares Square F Value Pr > F
Regression 4 121038 30259.5 10.30 0.0012
Residual 12 849.1 70.7575
Uncorrected Total 16 121887
Corrected Total 15 3034.4
Approx
Parameter Estimate Std Error Approximate 95% Confidence Limits
B0 172.9 27.5425 112.9 232.9
b1 -1.5269 0.5409 -2.7054 -0.3485
b2 0.8972 0.8235 -0.8971 2.6914
xvalue 58.0000 10.6597 34.7744 81.2256
Approximate Correlation Matrix
B0 b1 b2 xvalue
B0 1.0000000 -0.9941532 0.6529582 -0.3810699
b1 -0.9941532 1.0000000 -0.6567984 0.4170864
b2 0.6529582 -0.6567984 1.0000000 0.3258316
xvalue -0.3810699 0.4170864 0.3258316 1.0000000
69 PROC NLIN DATA=ONE MAXITER=200 METHOD=DUD;
69 * Methods: GAUSS | MARQUARDT | NEWTON | GRADIENT | DUD ;
70 TITLE2 'Piece wise regression where join-point is unknown';
71 PARAMETERS B0 = 172.8 b1=-1.52 b2=0.981 xvalue = 60;
72 x2 = 0; if x1 gt xvalue then x2=1;
73 MODEL Y = b0 + b1*x1 + b2*(x1-xvalue)*x2;
74 RUN;
NOTE: PROC NLIN grid search time was 0: 0: 0.
NOTE: Convergence criterion met.
NOTE: The PROCEDURE NLIN printed pages 207-208.
NOTE: PROCEDURE NLIN used:
real time 0.00 seconds
DUD Initialization Sum of
DUD B0 b1 b2 xvalue Squares
-5 172.8 -1.5200 0.9810 60.0000 872.4
-4 190.1 -1.5200 0.9810 60.0000 5525.7
-3 172.8 -1.6720 0.9810 60.0000 2336.2
-2 172.8 -1.5200 1.0791 60.0000 878.0
-1 172.8 -1.5200 0.9810 66.0000 1175.0
Iterative Phase Sum of
Iter B0 b1 b2 xvalue Squares
0 172.8 -1.5200 0.9810 60.0000 872.4
1 175.7 -1.5801 0.9143 57.5053 850.5
. . .
13 174.4 -1.5536 0.9100 58.0000 848.0
14 174.4 -1.5536 0.9100 58.0000 848.0
NOTE: Convergence criterion met.
Estimation Summary
Method DUD
Iterations 14
Object 2.821E-9
Objective 848.0422
Observations Read 16
Observations Used 16
Observations Missing 0
Sum of Mean Approx
Source DF Squares Square F Value Pr > F
Regression 4 121039 30259.7 10.31 0.0012
Residual 12 848.0 70.6702
Uncorrected Total 16 121887
Corrected Total 15 3034.4
Approx
Parameter Estimate Std Error Approximate 95% Confidence Limits
B0 174.4 31.2477 106.3 242.5
b1 -1.5536 0.6271 -2.9199 -0.1873
b2 0.9100 0.7850 -0.8004 2.6204
xvalue 58.0000 9.3450 37.6390 78.3610
Approximate Correlation Matrix
B0 b1 b2 xvalue
B0 1.0000000 -0.9948168 0.7946828 -0.5801406
b1 -0.9948168 1.0000000 -0.7988232 0.6213573
b2 0.7946828 -0.7988232 1.0000000 -0.1325735
xvalue -0.5801406 0.6213573 -0.1325735 1.0000000
1 *****************************************************************;
2 *** Chapter 10 ***;
3 *** Problem from Neter, Kutner, Nachtsheim, & Wasserman 1996 ***;
4 ****************************************************************;
5 OPTIONS LS=99 PS=256 NOCENTER NODATE NONUMBER;
6
7 DATA ONE; INFILE CARDS MISSOVER;
8 TITLE1 'EXST7034 - NKNW Table 10.11';
9 INPUT state $ 1-25 mathprof parents homelib reading tvwatch absences;
10 weight = 1;
11 * label mathprof = 'proficiency in math';
12 * label parents = '% 8th grade with both parents at home';
13 * label homelib = ''% 8th grade with 3 or more types of reference materials';
14 * label reading = ''% 8th grade who read more than 10 pages/day';
15 * label TVWatch = ''% 8th grade who watch TV 6 hrs or more daily';
16 * label Absences = ''% 8th grade absent 3 or more days last month';
17
18 *---+----1----+----2----+----3----+----4----+----5----+----6;
19 CARDS;
NOTE: The data set WORK.ONE has 40 observations and 8 variables.
NOTE: DATA statement used:
real time 0.04 seconds
19 ! RUN;
60 ;
61 Title2 'Robust regression';
62 OPTIONS LS=99 PS=56;
63 PROC REG DATA=ONE lineprinter; weight weight; id state;
64 MODEL mathprof = homelib / influence;
65 output out=next1a r=e p=yhat;
66 plot residual.*homelib;
67 run;
NOTE: 40 observations read.
NOTE: 40 observations used in computations.
NOTE: Some ID variables have been truncated to 16 characters.
NOTE: The data set WORK.NEXT1A has 40 observations and 10 variables.
NOTE: The PROCEDURE REG printed pages 1-5.
NOTE: PROCEDURE REG used:
real time 0.17 seconds
68 data next1a; set next1a; abse = abs(e); run;
. . .
127 proc print data=next4c; run;
NOTE: There were 41 observations read from the data set WORK.NEXT4C.
NOTE: The PROCEDURE PRINT printed page 12.
NOTE: PROCEDURE PRINT used:
real time 0.00 seconds
128 data next4c; set next4c; if mathprof eq . then delete;
129 drop mad mu yhat e abse; run;
NOTE: There were 41 observations read from the data set WORK.NEXT4C.
NOTE: The data set WORK.NEXT4C has 40 observations and 9 variables.
NOTE: DATA statement used:
real time 0.00 seconds
130
131 OPTIONS LS=99 PS=56;
132 PROC REG DATA=next4c lineprinter; weight weight;
133 MODEL mathprof = homelib;
134 plot residual.*homelib;
135 run;
NOTE: 40 observations read.
NOTE: 40 observations used in computations.
Earlier in the semester robust regression was demonstrated by mechanically recalculating weights and refitting the regression. Final results of that exercise are given below.
EXST7034 - NKNW Table 10.11
Robust regression m a
a p h r t b
m t a o e v s w
e s h r m a w e e
d t p e e d a n i y a
O i a r n l i t c g h b m
b a t o t i n c e h a s a m
s n e f s b g h s t t e e d u
1 4.46039 . . . . . . 1.00000 . . . 6.61288 .
2 . Alabama 252 75 78 34 18 18 1.00000 258.350 -6.3505 6.3505 6.61288 -0.96032
3 . Arizona 259 75 73 41 12 26 1.00000 250.950 8.0505 8.0505 6.61288 1.21739
4 . Arkansas 256 77 77 28 20 23 1.00000 256.870 -0.8703 0.8703 6.61288 -0.13161
5 . California 256 78 68 42 11 28 0.71432 243.549 12.4514 12.4514 6.61288 1.88291
6 . Colorado 267 78 85 38 9 25 1.00000 268.712 -1.7118 1.7118 6.61288 -0.25886
7 . Connecticut 270 79 86 43 12 22 1.00000 270.192 -0.1920 0.1920 6.61288 -0.02904
8 . Delaware 261 75 83 32 18 28 1.00000 265.751 -4.7514 4.7514 6.61288 -0.71851
9 . Distric of Columbia 231 47 76 24 33 37 0.36467 255.390 -24.3901 24.3901 6.61288 -3.68827
10 . Florida 255 75 73 31 19 27 1.00000 250.950 4.0505 4.0505 6.61288 0.61251
11 . Georgia 258 73 80 36 17 22 1.00000 261.311 -3.3109 3.3109 6.61288 -0.50067
12 . Guam 231 81 64 32 20 28 1.00000 237.628 -6.6278 6.6278 6.61288 -1.00225
13 . Hawaii 251 78 69 36 23 26 1.00000 245.029 5.9713 5.9713 6.61288 0.90297
14 . Idaho 272 84 84 48 7 21 1.00000 267.232 4.7684 4.7684 6.61288 0.72107
15 . Illinois 260 78 82 43 14 21 1.00000 264.271 -4.2713 4.2713 6.61288 -0.64590
16 . Indiana 267 81 84 37 11 23 1.00000 267.232 -0.2316 0.2316 6.61288 -0.03503
17 . Iowa 278 83 88 43 8 20 1.00000 273.152 4.8476 4.8476 6.61288 0.73305
18 . Kentucky 256 79 78 36 14 23 1.00000 258.350 -2.3505 2.3505 6.61288 -0.35544
19 . Louisiana 246 73 76 36 19 27 0.94720 255.390 -9.3901 9.3901 6.61288 -1.41997
20 . Maryland 260 75 83 34 19 27 1.00000 265.751 -5.7514 5.7514 6.61288 -0.86973
21 . Michigan 264 77 84 31 14 25 1.00000 267.232 -3.2316 3.2316 6.61288 -0.48869
22 . Minnesota 276 83 88 36 7 20 1.00000 273.152 2.8476 2.8476 6.61288 0.43061
23 . Montana 280 83 88 44 6 21 1.00000 273.152 6.8476 6.8476 6.61288 1.03549
24 . Nebraska 276 85 88 42 9 19 1.00000 273.152 2.8476 2.8476 6.61288 0.43061
25 . New Hampshire 273 83 88 40 7 22 1.00000 273.152 -0.1524 0.1524 6.61288 -0.02305
26 . New Jersey 269 79 84 41 13 23 1.00000 267.232 1.7684 1.7684 6.61288 0.26741
27 . New Mexico 256 77 72 40 11 27 1.00000 249.469 6.5307 6.5307 6.61288 0.98757
28 . New York 261 76 79 35 17 29 1.00000 259.831 1.1693 1.1693 6.61288 0.17683
29 . North Carolina 250 74 78 37 21 25 1.00000 258.350 -8.3505 8.3505 6.61288 -1.26276
30 . North Dakota 281 85 90 41 6 14 1.00000 276.113 4.8872 4.8872 6.61288 0.73904
31 . Ohio 264 79 84 36 11 22 1.00000 267.232 -3.2316 3.2316 6.61288 -0.48869
32 . Oklahoma 263 78 78 37 14 22 1.00000 258.350 4.6495 4.6495 6.61288 0.70310
33 . Oregon 271 81 82 41 9 31 1.00000 264.271 6.7287 6.7287 6.61288 1.01752
34 . Pennsylvania 266 80 86 34 10 24 1.00000 270.192 -4.1920 4.1920 6.61288 -0.63392
35 . Rhode Island 260 78 80 38 12 28 1.00000 261.311 -1.3109 1.3109 6.61288 -0.19823
36 . Texas 258 77 70 34 15 18 0.77402 246.509 11.4911 11.4911 6.61288 1.73768
37 . Virgin Islands 218 63 76 23 27 22 0.23788 255.390 -37.3901 37.3901 6.61288 -5.65413
38 . Virginia 264 78 82 33 16 24 1.00000 264.271 -0.2713 0.2713 6.61288 -0.04102
39 . West Virginia 256 82 80 36 16 25 1.00000 261.311 -5.3109 5.3109 6.61288 -0.80311
40 . Wisconsin 274 81 86 38 8 21 1.00000 270.192 3.8080 3.8080 6.61288 0.57584
41 . Wyoming 272 85 86 43 7 23 1.00000 270.192 1.8080 1.8080 6.61288 0.27340
EXST7034 - NKNW Table 10.11
Robust regression
The REG Procedure
Model: MODEL1
Dependent Variable: mathprof
Weight: weight
Analysis of Variance Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 3170.39031 3170.39031 78.00 <.0001
Error 38 1544.50010 40.64474
Corrected Total 39 4714.89041
Root MSE 6.37532 R-Square 0.6724
Dependent Mean 262.38623 Adj R-Sq 0.6638
Coeff Var 2.42975
Parameter Estimates Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 142.99058 13.55814 10.55 <.0001
homelib 1 1.47908 0.16747 8.83 <.0001
139 title 'Beaton/Tukey Biweight Robust Regression using IRLS';
NOTE: The PROCEDURE REG printed pages 13-14.
NOTE: PROCEDURE REG used:
real time 0.05 seconds
140 proc nlin data=one nohalve;
141 parms b0=142 b1=1.48;
142 model mathprof = b0 + b1*homelib;
143 resid=mathprof-model.mathprof;
144 sigma=2;
145 b=4.685;
146 r=abs(resid/sigma);
147 if r<=b then _weight_=(1-(r/b)**2)**2;
148 else _weight_=0;
149 output out=c r=rbi;
150 run;
NOTE: DER.b0 not initialized or missing. It will be computed automatically.
NOTE: DER.b1 not initialized or missing. It will be computed automatically.
NOTE: PROC NLIN grid search time was 0: 0: 0.
WARNING: PROC NLIN failed to converge.
NOTE: The data set WORK.C has 40 observations and 9 variables.
NOTE: The PROCEDURE NLIN printed pages 15-16.
NOTE: PROCEDURE NLIN used:
real time 0.11 seconds
151
152 data c;
153 set c;
154 sigma=2;
155 b=4.685;
156 r=abs(rbi/sigma);
157 if r<=b then _weight_=(1-(r/b)**2)**2;
158 else _weight_=0;
NOTE: There were 40 observations read from the data set WORK.C.
NOTE: The data set WORK.C has 40 observations and 13 variables.
NOTE: DATA statement used:
real time 0.00 seconds
159 proc print;
160 run;
NOTE: There were 40 observations read from the data set WORK.C.
NOTE: The PROCEDURE PRINT printed page 17.
NOTE: PROCEDURE PRINT used:
real time 0.00 seconds
Beaton/Tukey Biweight Robust Regression using IRLS
The NLIN Procedure
Dependent Variable mathprof
Method: Gauss-Newton
Iterative Phase
Weighted
Iter b0 b1 SS
0 142.0 1.4800 249.9
1 138.7 1.5205 246.9
2 138.3 1.5262 246.3
3 138.0 1.5290 246.0
. . .
21 137.9 1.5309 245.8
22 137.9 1.5309 245.8
23 137.9 1.5309 245.8
WARNING: Step size shows no improvement.
WARNING: PROC NLIN failed to converge.
Estimation Summary (Not Converged)
Method Gauss-Newton
Iterations 23
Subiterations 49
Average Subiterations 2.130435
R 0.274148
PPC(b1) 0.120528
RPC .
Object 1
Objective 245.784
Observations Read 40
Observations Used 36
Observations Missing 4
Beaton/Tukey Biweight Robust Regression using IRLS
The NLIN Procedure Sum of Mean Approx
Source DF Squares Square F Value Pr > F
Regression 2 1565584 782792 213.13 <.0001
Residual 34 245.8 7.2289
Uncorrected Total 36 1565830
Corrected Total 35 1786.5
Approx
Parameter Estimate Std Error Approximate 95% Confidence Limits
b0 137.9 9.6465 118.3 157.5
b1 1.5309 0.1168 1.2935 1.7682
Approximate Correlation Matrix
b0 b1
b0 1.0000000 -0.9982646
b1 -0.9982646 1.0000000
Beaton/Tukey Biweight Robust Regression using IRLS
m a _
a p h r t b w
t a o e v s w e
s h r m a w e e s i
t p e e d a n i i g
O a r n l i t c g R g h
b t o t i n c e h B m t
s e f s b g h s t I a b r _
1 Alabama 252 75 78 34 18 18 1 -5.2843 2 4.685 2.6421 0.46506
2 Arizona 259 75 73 41 12 26 1 9.3700 2 4.685 4.6850 0.00000
3 Arkansas 256 77 77 28 20 23 1 0.2466 2 4.685 0.1233 0.99862
4 California 256 78 68 42 11 28 1 14.0243 2 4.685 7.0121 0.00000
5 Colorado 267 78 85 38 9 25 1 -1.0003 2 4.685 0.5001 0.97734
6 Connecticut 270 79 86 43 12 22 1 0.4689 2 4.685 0.2344 0.99500
7 Delaware 261 75 83 32 18 28 1 -3.9386 2 4.685 1.9693 0.67785
8 Distric of Columbia 231 47 76 24 33 37 1 -23.2226 2 4.685 11.6113 0.00000
9 Florida 255 75 73 31 19 27 1 5.3700 2 4.685 2.6850 0.45098
10 Georgia 258 73 80 36 17 22 1 -2.3460 2 4.685 1.1730 0.87856
11 Guam 231 81 64 32 20 28 1 -4.8523 2 4.685 2.4262 0.53557
12 Hawaii 251 78 69 36 23 26 1 7.4934 2 4.685 3.7467 0.12992
13 Idaho 272 84 84 48 7 21 1 5.5306 2 4.685 2.7653 0.42460
14 Illinois 260 78 82 43 14 21 1 -3.4077 2 4.685 1.7038 0.75297
15 Indiana 267 81 84 37 11 23 1 0.5306 2 4.685 0.2653 0.99360
16 Iowa 278 83 88 43 8 20 1 5.4072 2 4.685 2.7036 0.44487
17 Kentucky 256 79 78 36 14 23 1 -1.2843 2 4.685 0.6421 0.96278
18 Louisiana 246 73 76 36 19 27 1 -8.2226 2 4.685 4.1113 0.05286
19 Maryland 260 75 83 34 19 27 1 -4.9386 2 4.685 2.4693 0.52158
20 Michigan 264 77 84 31 14 25 1 -2.4694 2 4.685 1.2347 0.86591
21 Minnesota 276 83 88 36 7 20 1 3.4072 2 4.685 1.7036 0.75304
22 Montana 280 83 88 44 6 21 1 7.4072 2 4.685 3.7036 0.14068
23 Nebraska 276 85 88 42 9 19 1 3.4072 2 4.685 1.7036 0.75304
24 New Hampshire 273 83 88 40 7 22 1 0.4072 2 4.685 0.2036 0.99623
25 New Jersey 269 79 84 41 13 23 1 2.5306 2 4.685 1.2653 0.85944
26 New Mexico 256 77 72 40 11 27 1 7.9009 2 4.685 3.9504 0.08352
27 New York 261 76 79 35 17 29 1 2.1849 2 4.685 1.0924 0.89421
28 North Carolina 250 74 78 37 21 25 1 -7.2843 2 4.685 3.6421 0.15653
29 North Dakota 281 85 90 41 6 14 1 5.3455 2 4.685 2.6727 0.45501
30 Ohio 264 79 84 36 11 22 1 -2.4694 2 4.685 1.2347 0.86591
31 Oklahoma 263 78 78 37 14 22 1 5.7157 2 4.685 2.8579 0.39425
32 Oregon 271 81 82 41 9 31 1 7.5923 2 4.685 3.7962 0.11796
33 Pennsylvania 266 80 86 34 10 24 1 -3.5311 2 4.685 1.7656 0.73613
34 Rhode Island 260 78 80 38 12 28 1 -0.3460 2 4.685 0.1730 0.99727
35 Texas 258 77 70 34 15 18 1 12.9626 2 4.685 6.4813 0.00000
36 Virgin Islands 218 63 76 23 27 22 1 -36.2226 2 4.685 18.1113 0.00000
37 Virginia 264 78 82 33 16 24 1 0.5923 2 4.685 0.2962 0.99202
38 West Virginia 256 82 80 36 16 25 1 -4.3460 2 4.685 2.1730 0.61602
39 Wisconsin 274 81 86 38 8 21 1 4.4689 2 4.685 2.2344 0.59681
40 Wyoming 272 85 86 43 7 23 1 2.4689 2 4.685 1.2344 0.86597