/* Chapter 10: Partial plots and Diagnostics */ OPTIONS LS=77 PS=60 NODATE PAGENO=1; DATA one; INPUT x1 x2 x3 y; DATALINES; 19.5 43.1 29.1 11.9 24.7 49.8 28.2 22.8 30.7 51.9 37.0 18.7 29.8 54.3 31.1 20.1 19.1 42.2 30.9 12.9 25.6 53.9 23.7 21.7 31.4 58.5 27.6 27.1 27.9 52.1 30.6 25.4 22.1 49.9 23.2 21.3 25.5 53.5 24.8 19.3 31.1 56.6 30.0 25.4 30.4 56.7 28.3 27.2 18.7 46.5 23.0 11.7 19.7 44.2 28.6 17.8 14.6 42.7 21.3 12.8 29.5 54.4 30.1 23.9 27.7 55.3 25.7 22.6 30.2 58.6 24.6 25.4 22.7 48.2 27.1 14.8 25.2 51.0 27.5 21.1 ; PROC REG DATA=one; MODEL y=x2; MODEL y=x1 x2 x3; RUN; PROC SGPLOT DATA=one; REG X=x2 Y=y; TITLE "Marginal Plot of X2"; RUN; PROC REG DATA=one NOPRINT; MODEL y = x1 x3; OUTPUT OUT=temp1 R=res1; RUN; PROC REG DATA=one NOPRINT; MODEL x2 = x1 x3; OUTPUT OUT=temp2 R=res2; RUN; DATA two; MERGE temp1 temp2; RUN; PROC PRINT; RUN; PROC REG DATA=two; MODEL res1 = res2; RUN; PROC SGPLOT DATA=two; REG X=res2 Y=res1; TITLE "Partial Plot of X2 Given (X1, X3)"; RUN; PROC REG; TITLE 'Partial Plots'; MODEL y = x1 x2 x3 / PARTIAL; RUN; PROC REG; TITLE 'Diagnostics for residuals and influential observations'; MODEL Y = x1 x2 / R INFLUENCE; RUN; QUIT; ******************************************************************************* Diagnostics for residuals and influential observations 1 The REG Procedure Model: MODEL1 Dependent Variable: y Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 381.96582 381.96582 60.62 <.0001 Error 18 113.42368 6.30132 Corrected Total 19 495.38950 Root MSE 2.51024 R-Square 0.7710 Dependent Mean 20.19500 Adj R-Sq 0.7583 Coeff Var 12.43002 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 -23.63449 5.65741 -4.18 0.0006 x2 1 0.85655 0.11002 7.79 <.0001 Diagnostics for residuals and influential observations 2 The REG Procedure Model: MODEL2 Dependent Variable: y Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 396.98461 132.32820 21.52 <.0001 Error 16 98.40489 6.15031 Corrected Total 19 495.38950 Root MSE 2.47998 R-Square 0.8014 Dependent Mean 20.19500 Adj R-Sq 0.7641 Coeff Var 12.28017 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 117.08469 99.78240 1.17 0.2578 x1 1 4.33409 3.01551 1.44 0.1699 x2 1 -2.85685 2.58202 -1.11 0.2849 x3 1 -2.18606 1.59550 -1.37 0.1896 Marginal Plot of X2 3 Obs x1 x2 x3 y res1 res2 1 19.5 43.1 29.1 11.9 -1.84807 -0.38746 2 24.7 49.8 28.2 22.8 3.46059 -0.30783 3 30.7 51.9 37.0 18.7 -2.84623 0.19586 4 29.8 54.3 31.1 20.1 -3.09121 0.02236 5 19.1 42.2 30.9 12.9 0.32876 0.28480 6 25.6 53.9 23.7 21.7 -0.48143 -0.02180 7 31.4 58.5 27.6 27.1 0.79781 0.20578 8 27.9 52.1 30.6 25.4 3.89418 -0.26771 9 22.1 49.9 23.2 21.3 2.40490 -0.24493 10 25.5 53.5 24.8 19.3 -2.30678 0.37048 11 31.1 56.6 30.0 25.4 0.43344 0.12986 12 30.4 56.7 28.3 27.2 2.20040 0.00255 13 18.7 46.5 23.0 11.7 -3.87940 0.19952 14 19.7 44.2 28.6 17.8 3.63609 0.17208 15 14.6 42.7 21.3 12.8 0.58955 0.13949 16 29.5 54.4 30.1 23.9 0.57752 -0.14176 17 27.7 55.3 25.7 22.6 -0.81977 0.15617 18 30.2 58.6 24.6 25.4 -0.99582 -0.13654 19 22.7 48.2 27.1 14.8 -3.01283 -0.24973 20 25.2 51.0 27.5 21.1 0.95829 -0.12118 Marginal Plot of X2 4 The REG Procedure Model: MODEL1 Dependent Variable: res1 Residual Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 7.52928 7.52928 1.38 0.2559 Error 18 98.40489 5.46694 Corrected Total 19 105.93417 Root MSE 2.33815 R-Square 0.0711 Dependent Mean -8.8818E-15 Adj R-Sq 0.0195 Coeff Var -2.63252E16 Parameter Estimates Parameter Standard Variable Label DF Estimate Error t Value Pr > |t| Intercept Intercept 1 -4.542E-14 0.52283 -0.00 1.0000 res2 Residual 1 -2.85685 2.43435 -1.17 0.2559 Partial Plots 5 The REG Procedure Model: MODEL1 Dependent Variable: y Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 396.98461 132.32820 21.52 <.0001 Error 16 98.40489 6.15031 Corrected Total 19 495.38950 Root MSE 2.47998 R-Square 0.8014 Dependent Mean 20.19500 Adj R-Sq 0.7641 Coeff Var 12.28017 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 117.08469 99.78240 1.17 0.2578 x1 1 4.33409 3.01551 1.44 0.1699 x2 1 -2.85685 2.58202 -1.11 0.2849 x3 1 -2.18606 1.59550 -1.37 0.1896 Diagnostics for residuals and influential observations 6 The REG Procedure Model: MODEL1 Dependent Variable: y Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 385.43871 192.71935 29.80 <.0001 Error 17 109.95079 6.46769 Corrected Total 19 495.38950 Root MSE 2.54317 R-Square 0.7781 Dependent Mean 20.19500 Adj R-Sq 0.7519 Coeff Var 12.59305 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 -19.17425 8.36064 -2.29 0.0348 x1 1 0.22235 0.30344 0.73 0.4737 x2 1 0.65942 0.29119 2.26 0.0369 Diagnostics for residuals and influential observations 7 The REG Procedure Model: MODEL1 Dependent Variable: y Output Statistics Dependent Predicted Std Error Std Error Student Obs Variable Value Mean Predict Residual Residual Residual 1 11.9000 13.5827 1.1402 -1.6827 2.273 -0.740 2 22.8000 19.1571 0.6172 3.6429 2.467 1.477 3 18.7000 21.8760 1.5510 -3.1760 2.015 -1.576 4 20.1000 23.2585 0.8471 -3.1585 2.398 -1.317 5 12.9000 12.9003 1.2665 -0.000289 2.205 -0.0001 6 21.7000 22.0608 0.9121 -0.3608 2.374 -0.152 7 27.1000 26.3838 1.0029 0.7162 2.337 0.306 8 25.4000 21.3853 0.7892 4.0147 2.418 1.661 9 21.3000 18.6449 0.8611 2.6551 2.393 1.110 10 19.3000 21.7748 0.8444 -2.4748 2.399 -1.032 11 25.4000 25.0642 0.8822 0.3358 2.385 0.141 12 27.2000 24.9745 0.8407 2.2255 2.400 0.927 13 11.7000 15.6469 1.0741 -3.9469 2.305 -1.712 14 17.8000 14.3525 0.9784 3.4475 2.347 1.469 15 12.8000 12.2294 1.4680 0.5706 2.077 0.275 16 23.9000 23.2577 0.7850 0.6423 2.419 0.266 17 22.6000 23.4509 0.8264 -0.8509 2.405 -0.354 18 25.4000 26.1829 1.1282 -0.7829 2.279 -0.344 19 14.8000 17.6573 0.6581 -2.8573 2.457 -1.163 20 21.1000 20.0596 0.5692 1.0404 2.479 0.420 Output Statistics Cook's Hat Diag Cov Obs -2-1 0 1 2 D RStudent H Ratio DFFITS 1 | *| | 0.046 -0.7300 0.2010 1.3607 -0.3661 2 | |** | 0.045 1.5343 0.0589 0.8443 0.3838 3 | ***| | 0.490 -1.6543 0.3719 1.1892 -1.2731 4 | **| | 0.072 -1.3485 0.1109 0.9768 -0.4763 5 | | | 0.000 -0.000127 0.2480 1.5951 -0.0001 6 | | | 0.001 -0.1475 0.1286 1.3709 -0.0567 7 | | | 0.006 0.2981 0.1555 1.3969 0.1279 8 | |*** | 0.098 1.7601 0.0963 0.7805 0.5745 9 | |** | 0.053 1.1176 0.1146 1.0812 0.4022 10 | **| | 0.044 -1.0337 0.1102 1.1104 -0.3639 11 | | | 0.001 0.1367 0.1203 1.3588 0.0505 12 | |* | 0.035 0.9232 0.1093 1.1525 0.3233 13 | ***| | 0.212 -1.8259 0.1784 0.8274 -0.8508 14 | |** | 0.125 1.5248 0.1480 0.9371 0.6355 15 | | | 0.013 0.2672 0.3332 1.7750 0.1889 16 | | | 0.002 0.2581 0.0953 1.3094 0.0838 17 | | | 0.005 -0.3445 0.1056 1.3117 -0.1184 18 | | | 0.010 -0.3344 0.1968 1.4625 -0.1655 19 | **| | 0.032 -1.1762 0.0670 1.0024 -0.3151 20 | | | 0.003 0.4094 0.0501 1.2238 0.0940 Diagnostics for residuals and influential observations 8 The REG Procedure Model: MODEL1 Dependent Variable: y Output Statistics -------------DFBETAS------------- Obs Intercept x1 x2 1 -0.3052 -0.1315 0.2320 2 0.1726 0.1150 -0.1426 3 -0.8471 -1.1825 1.0669 4 -0.1016 -0.2935 0.1961 5 -0.0001 -0.0000 0.0001 6 0.0397 0.0401 -0.0443 7 -0.0775 -0.0156 0.0543 8 0.2614 0.3911 -0.3325 9 -0.1514 -0.2947 0.2469 10 0.2377 0.2446 -0.2688 11 -0.0090 0.0171 -0.0025 12 -0.1305 0.0225 0.0700 13 0.1194 0.5924 -0.3895 14 0.4517 0.1132 -0.2977 15 -0.0030 -0.1248 0.0688 16 0.0093 0.0431 -0.0251 17 0.0795 0.0550 -0.0761 18 0.1321 0.0753 -0.1161 19 -0.1296 -0.0041 0.0644 20 0.0102 0.0023 -0.0033 Sum of Residuals 0 Sum of Squared Residuals 109.95079 Predicted Residual SS (PRESS) 154.47356