1          ***************************************************************;
2          *** EXST7034 Homework Example                               ***;
3          *** Problem from Neter, Wasserman & Kuttner 1989, Table 9.1 ***;
4          ***************************************************************;
5
6          OPTIONS LS=133 PS=256 NOCENTER NODATE NONUMBER;
7
8          DATA ONE; INFILE CARDS MISSOVER;
9               TITLE1 'EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales';
10            INPUT Cafteria X1 Y LINE QUAD CUBE QUAR QUIN SEST;
11                X2=X1*X1; X3=X1*X2; X4=X1*X3; X5=X1*X4; X6=X1*X5; ANOTHERX=X1;
12                D1 = X1 - 3;
13                D2=D1*D1; D3=D1*D2; D4=D1*D3; D5=D1*D4; D6=D1*D5; ANOTHERD=D1;
14                  LABEL X1 = 'X : Number of Dispensers';
15                  LABEL D1 = 'X - Xmean : Deviation units';
16                  LABEL Y = 'Coffee sales (x 100 gals)';
17                  LABEL X2 = 'X Squared';   LABEL X3 = 'X Cubed';
18                  LABEL X4 = 'X**4';   LABEL X5 = 'X**5';   LABEL X6 = 'X**6';
19                  LABEL D2 = 'D Squared';   LABEL D3 = 'D Cubed';
20                  LABEL D4 = 'D**4';   LABEL D5 = 'D**5';   LABEL D6 = 'D**6';
21         CARDS;
NOTE: The data set WORK.ONE has 14 observations and 22 variables.
NOTE: DATA statement used:       real time           0.10 seconds
21       !        RUN;
36         ;
37         PROC IML;
NOTE: IML Ready
37       !           RESET PRINT;
38            X={0, 1 , 2 , 3 , 4 , 5,  6};
39            O=ORPOL(X,3);
39       !                  RUN;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
40         QUIT;
NOTE: Exiting IML.
NOTE: The PROCEDURE IML printed page 1.
NOTE: PROCEDURE IML used:       real time           0.17 seconds
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales

X      7 rows      1 col     (numeric)
        0
        1
        2
        3
        4
        5
        6

O      7 rows      4 cols    (numeric)

0.3779645  -0.566947  0.5455447  -0.408248
0.3779645  -0.377964  2.165E-16  0.4082483
0.3779645  -0.188982  -0.327327  0.4082483
0.3779645  -6.97E-17  -0.436436  -3.42E-17
0.3779645  0.1889822  -0.327327  -0.408248
0.3779645  0.3779645  -8.18E-17  -0.408248
0.3779645  0.5669467  0.5455447  0.4082483

The numbers in each column can be multiplied by the value:
2.645751122 5.291502711 9.16515182 2.449489686
To yield more integer like values in each column:
1 -3.00000159  5.00000000 -0.99999927
1 -1.99999753  0.00000000  1.00000000
1 -0.99999877 -3.00000165  1.00000000
1  0.00000000 -4.00000220  0.00000000
1  0.99999982 -3.00000165 -0.99999927
1  2.00000018  0.00000000 -0.99999927
1  3.00000000  5.00000000  1.00000000
 

42         PROC PRINT DATA=ONE; VAR X1 Y D1 D2 D3 LINE QUAD CUBE QUAR QUIN SEST;
43               TITLE2 'Raw Data Listing'; RUN;
NOTE: There were 14 observations read from the data set WORK.ONE.
NOTE: The PROCEDURE PRINT printed page 2.
NOTE: PROCEDURE PRINT used:       real time           0.04 seconds

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Raw Data Listing
Obs    X1      Y      D1    D2     D3    LINE    QUAD    CUBE    QUAR    QUIN    SEST
  1     0    508.1    -3     9    -27     -3       5       1       3      -1        1
  2     0    498.4    -3     9    -27     -3       5       1       3      -1        1
  3     1    568.2    -2     4     -8     -2       0      -1      -7       4       -6
  4     1    577.3    -2     4     -8     -2       0      -1      -7       4       -6
  5     2    651.7    -1     1     -1     -1      -3      -1       1      -5       15
  6     2    657.0    -1     1     -1     -1      -3      -1       1      -5       15
  7     3    713.4     0     0      0      0      -4       0       6       0      -20
  8     3    697.5     0     0      0      0      -4       0       6       0      -20
  9     4    755.3     1     1      1      1      -3       1       1       5       15
 10     4    758.9     1     1      1      1      -3       1       1       5       15
 11     5    787.6     2     4      8      2       0       1      -7      -4       -6
 12     5    792.1     2     4      8      2       0       1      -7      -4       -6
 13     6    841.4     3     9     27      3       5      -1       3       1        1
 14     6    831.8     3     9     27      3       5      -1       3       1        1
 

44         OPTIONS PS=55; PROC PLOT DATA=ONE;  PLOT Y*X1; RUN; OPTIONS PS=256;
NOTE: There were 14 observations read from the data set WORK.ONE.
NOTE: The PROCEDURE PLOT printed page 3.
NOTE: PROCEDURE PLOT used:       real time           0.00 seconds

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Raw Data Listing

                                 Plot of Y*X1.  Legend: A = 1 obs, B = 2 obs, etc.
      |
  850 +
      |                                                                                                        A
      |                                                                                                        A
      |
      |
      |
  800 +
      |                                                                                       B
C     |
o     |
f     |
f     |                                                                      B
e 750 +
e     |
      |
s     |
a     |                                                     A
l     |
e 700 +                                                     A
s     |
      |
(     |
x     |
      |                                    A
1 650 +                                    A
0     |
0     |
      |
g     |
a     |
l 600 +
s     |
)     |
      |                   A
      |                   A
      |
  550 +
      |
      |
      |
      |
      |  A
  500 +  A
      ---+----------------+----------------+----------------+----------------+----------------+----------------+--
         0                1                2                3                4                5                6
                                                     X : Number of Dispensers

45         PROC REG DATA=ONE; TITLE2 'Fits of levels of Deviation units as a polynomial';
46                 Quadratc:MODEL Y= D1 D2 / SS1 SS2;
47                 Sestic:MODEL   Y = D1 D2 D3 D4 D5 D6 / SS1 SS2; RUN;
NOTE: 14 observations read.
NOTE: 14 observations used in computations.
NOTE: The PROCEDURE REG printed pages 4-5.
NOTE: PROCEDURE REG used:       real time           0.26 seconds
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Fits of levels of Deviation units as a polynomial

The REG Procedure
Model: Quadratc
Dependent Variable: Y Coffee sales (x 100 gals)

                             Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     2         171773          85887    1390.94    <.0001
Error                    11      679.22048       61.74732
Corrected Total          13         172453

Root MSE              7.85795    R-Square     0.9961
Dependent Mean      688.47857    Adj R-Sq     0.9953
Coeff Var             1.14135

Parameter Estimates
                                                 Parameter    Standard
Variable     Label                          DF    Estimate       Error    t Value    Pr |t|      Type I SS     Type II SS
Intercept    Intercept                       1   705.47381     3.20799     219.91      <.0001        6636038        2986160
D1           X - Xmean : Deviation units     1    54.89286     1.05006      52.28      <.0001         168741         168741
D2           D Squared                       1    -4.24881     0.60625      -7.01      <.0001     3032.80024     3032.80024
 
 
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Fits of levels of Deviation units as a polynomial

The REG Procedure
Model: Sestic
Dependent Variable: Y Coffee sales (x 100 gals)

                             Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     6         172161          28694     688.84    <.0001
Error                     7      291.58500       41.65500
Corrected Total          13         172453

Root MSE              6.45407    R-Square     0.9983
Dependent Mean      688.47857    Adj R-Sq     0.9969
Coeff Var             0.93744

Parameter Estimates
                                                 Parameter     Standard
Variable     Label                          DF    Estimate        Error    t Value    Pr |t|      Type I SS     Type II SS
Intercept    Intercept                       1   705.45000      4.56372     154.58      <.0001        6636038         995319
D1           X - Xmean : Deviation units     1    50.05333      4.93759      10.14      <.0001         168741     4280.59337
D2           D Squared                       1     3.64028      7.89000       0.46      0.6585     3032.80024        8.86712
D3           D Cubed                         1     1.41042      2.05684       0.69      0.5150       60.75000       19.58671
D4           D**4                            1    -3.68056      2.54883      -1.44      0.1920      204.54870       86.85838
D5           D**5                            1    -0.08875      0.17428      -0.51      0.6262       10.80214       10.80214
D6           D**6                            1     0.31528      0.19267       1.64      0.1458      111.53463      111.53463

 48         PROC REG DATA=ONE; TITLE2 'Fits of levels of the original X as a polynomial';
49                 Quadratc:MODEL Y= X1 X2 / SS1 SS2;
50                 Sestic:MODEL   Y = X1 X2 X3 X4 X5 X6 / SS1 SS2; RUN;
NOTE: 14 observations read.
NOTE: 14 observations used in computations.
NOTE: The PROCEDURE REG printed pages 6-7.
NOTE: PROCEDURE REG used:       real time           0.00 seconds
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Fits of levels of the original X as a polynomial

The REG Procedure
Model: Quadratc
Dependent Variable: Y Coffee sales (x 100 gals)

                             Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     2         171773          85887    1390.94    <.0001
Error                    11      679.22048       61.74732
Corrected Total          13         172453

Root MSE              7.85795    R-Square     0.9961
Dependent Mean      688.47857    Adj R-Sq     0.9953
Coeff Var             1.14135

Parameter Estimates
                                                Parameter       Standard
Variable     Label                        DF     Estimate          Error    t Value    Pr |t|      Type I SS     Type II SS
Intercept    Intercept                     1    502.55595        4.85003     103.62      <.0001        6636038         662977
X1           X : Number of Dispensers      1     80.38571        3.78605      21.23      <.0001         168741          27836
X2           X Squared                     1     -4.24881        0.60625      -7.01      <.0001     3032.80024     3032.80024
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Fits of levels of the original X as a polynomial

The REG Procedure
Model: Sestic
Dependent Variable: Y Coffee sales (x 100 gals)

                             Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     6         172161          28694     688.84    <.0001
Error                     7      291.58500       41.65500
Corrected Total          13         172453

Root MSE              6.45407    R-Square     0.9983
Dependent Mean      688.47857    Adj R-Sq     0.9969
Coeff Var             0.93744

Parameter Estimates
                                               Parameter    Standard
Variable     Label                        DF    Estimate       Error    t Value    Pr |t|      Type I SS     Type II SS
Intercept    Intercept                     1   503.25000     4.56372     110.27      <.0001        6636038         506521
X1           X : Number of Dispensers      1   -31.82583    57.40625      -0.55      0.5966         168741       12.80290
X2           X Squared                     1   199.22153   108.88923       1.83      0.1100     3032.80024      139.43435
X3           X Cubed                       1  -132.66042    74.86717      -1.77      0.1197       60.75000      130.78775
X4           X**4                          1    40.21319    23.61725       1.70      0.1324      204.54870      120.76628
X5           X**5                          1    -5.76375     3.47250      -1.66      0.1409       10.80214      114.76064
X6           X**6                          1     0.31528     0.19267       1.64      0.1458      111.53463      111.53463
 51         PROC REG DATA=ONE; TITLE2 'Orthogonal polynomial variables';
52              MODEL  Y = LINE QUAD CUBE QUAR QUIN SEST / SS1 SS2; RUN;
NOTE: 14 observations read.
NOTE: 14 observations used in computations.
NOTE: The PROCEDURE REG printed page 8.
NOTE: PROCEDURE REG used:       real time           0.05 seconds

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Orthogonal polynomial variables

The REG Procedure
Model: MODEL1
Dependent Variable: Y Coffee sales (x 100 gals)

                             Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     6         172161          28694     688.84    <.0001
Error                     7      291.58500       41.65500
Corrected Total          13         172453

Root MSE              6.45407    R-Square     0.9983
Dependent Mean      688.47857    Adj R-Sq     0.9969
Coeff Var             0.93744

Parameter Estimates
                                Parameter       Standard
Variable     Label        DF     Estimate          Error    t Value    Pr |t|      Type I SS     Type II SS
Intercept    Intercept     1    688.47857        1.72492     399.14      <.0001        6636038        6636038
LINE                       1     54.89286        0.86246      63.65      <.0001         168741         168741
QUAD                       1     -4.24881        0.49794      -8.53      <.0001     3032.80024     3032.80024
CUBE                       1     -2.25000        1.86313      -1.21      0.2664       60.75000       60.75000
QUAR                       1      0.81494        0.36775       2.22      0.0622      204.54870      204.54870
QUIN                       1     -0.25357        0.49794      -0.51      0.6262       10.80214       10.80214
SEST                       1      0.24567        0.15014       1.64      0.1458      111.53463      111.53463
 
 
 

53         PROC REG DATA=ONE; TITLE2 'Lack of Fit with PROC REG';
54              MODEL  Y = X1 X2 X3 X4 X5 X6 / SS1 SS2;
55                    Linear:test X2=0, X3=0, X4=0, X5=0, X6=0;
56                 Quadratic:test X3=0, X4=0, X5=0, X6=0;
57                     Cubic:test X4=0, X5=0, X6=0;
58                   Quartic:test X5=0, X6=0;
59         RUN;
NOTE: 14 observations read.
NOTE: 14 observations used in computations.
NOTE: The PROCEDURE REG printed pages 9-13.
NOTE: PROCEDURE REG used:       real time           0.00 seconds
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Lack of Fit with PROC REG

The REG Procedure
Model: MODEL1
Dependent Variable: Y Coffee sales (x 100 gals)

Analysis of Variance                Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     6         172161          28694     688.84    <.0001
Error                     7      291.58500       41.65500
Corrected Total          13         172453

Root MSE              6.45407    R-Square     0.9983
Dependent Mean      688.47857    Adj R-Sq     0.9969
Coeff Var             0.93744

Parameter Estimates
                                               Parameter     Standard
Variable     Label                        DF    Estimate        Error    t Value    Pr |t|      Type I SS     Type II SS
Intercept    Intercept                     1   503.25000      4.56372     110.27      <.0001        6636038         506521
X1           X : Number of Dispensers      1   -31.82583     57.40625      -0.55      0.5966         168741       12.80290
X2           X Squared                     1   199.22153    108.88923       1.83      0.1100     3032.80024      139.43435
X3           X Cubed                       1  -132.66042     74.86717      -1.77      0.1197       60.75000      130.78775
X4           X**4                          1    40.21319     23.61725       1.70      0.1324      204.54870      120.76628
X5           X**5                          1    -5.76375      3.47250      -1.66      0.1409       10.80214      114.76064
X6           X**6                          1     0.31528      0.19267       1.64      0.1458      111.53463      111.53463

Test Linear Results for Dependent Variable Y
                                Mean
Source             DF         Square    F Value    Pr F
Numerator           5      684.08714      16.42    0.0010
Denominator         7       41.65500

Test Quadratic Results for Dependent Variable Y
                                Mean
Source             DF         Square    F Value    Pr F
Numerator           4       96.90887       2.33    0.1554
Denominator         7       41.65500

Test Cubic Results for Dependent Variable Y
                                Mean
Source             DF         Square    F Value    Pr F
Numerator           3      108.96183       2.62    0.1330
Denominator         7       41.65500

Test Quartic Results for Dependent Variable Y
                                Mean
Source             DF         Square    F Value    Pr F
Numerator           2       61.16839       1.47    0.2934
Denominator         7       41.65500
 

60         PROC mixed DATA=ONE; CLASSES X1;
61                 TITLE2 'Demonstration of Orthogonal Polynomial contrasts PROC MIXED';
62              MODEL  Y = X1 / Htype=1 2 3;
63                 CONTRAST 'OrPol: Linear'    X1 -3  -2  -1   0   1   2   3;
64                 CONTRAST 'OrPol: Quadratic' X1 -5   0   3   4   3   0  -5;
65                 CONTRAST 'OrPol: Cubic'     X1  1  -1  -1   0   1   1  -1;
66                 CONTRAST 'OrPol: Quartic'   X1  3  -7   1   6   1  -7   3;
67                 CONTRAST 'OrPol: Quintic'   X1  1  -4   5   0  -5   4  -1;
68                 CONTRAST 'OrPol: Sestic'    X1  1  -6  15 -20  15  -6   1; RUN;
NOTE: The PROCEDURE MIXED printed page 14.
NOTE: PROCEDURE MIXED used:       real time           0.05 seconds
 EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Demonstration of Orthogonal Polynomial contrasts PROC MIXED

The Mixed Procedure
                  Model Information
Data Set                     WORK.ONE
Dependent Variable           Y
Covariance Structure         Diagonal
Estimation Method            REML
Residual Variance Method     Profile
Fixed Effects SE Method      Model-Based
Degrees of Freedom Method    Residual

             Class Level Information
Class    Levels    Values
X1            7    0 1 2 3 4 5 6

            Dimensions
Covariance Parameters             1
Columns in X                      8
Columns in Z                      0
Subjects                          1
Max Obs Per Subject              14
Observations Used                14
Observations Not Used             0
Total Observations               14

Covariance Parameter Estimates
Cov Parm     Estimate
Residual      41.6550

Fit Statistics
-2 Res Log Likelihood            50.8
AIC (smaller is better)          52.8
AICC (smaller is better)         53.6
BIC (smaller is better)          52.8

Type 1 Tests of Fixed Effects
              Num     Den
Effect         DF      DF    F Value    Pr F
X1              6       7     688.84    <.0001

Type 2 Tests of Fixed Effects
              Num     Den
Effect         DF      DF    F Value    Pr F
X1              6       7     688.84    <.0001

Type 3 Tests of Fixed Effects
              Num     Den
Effect         DF      DF    F Value    Pr F
X1              6       7     688.84    <.0001

                      Contrasts
                     Num     Den
Label                 DF      DF    F Value    Pr F
OrPol: Linear          1       7    4050.91    <.0001
OrPol: Quadratic       1       7      72.81    <.0001
OrPol: Cubic           1       7       1.46    0.2664
OrPol: Quartic         1       7       4.91    0.0622
OrPol: Quintic         1       7       0.26    0.6262
OrPol: Sestic          1       7       2.68    0.1458
 69         PROC REG DATA=ONE;
70               TITLE2 'Quadratic polynomial regression on D with Diagnostics';
71            MODEL  Y = D1 D2 / XPX I P CLM CLI; RUN;
NOTE: 14 observations read.
NOTE: 14 observations used in computations.
72               OUTPUT OUT=RESIDSD PREDICTED=YHAT RESIDUAL=E; OPTIONS PS=35; RUN;
NOTE: The data set WORK.RESIDSD has 14 observations and 24 variables.
NOTE: The PROCEDURE REG printed pages 15-17.
NOTE: PROCEDURE REG used:       real time           0.10 seconds
73         PROC PLOT DATA=RESIDSD;  PLOT E*X1='x' / VREF=0; RUN;
NOTE: There were 14 observations read from the data set WORK.RESIDSD.
NOTE: The PROCEDURE PLOT printed page 18.
NOTE: PROCEDURE PLOT used:       real time           0.00 seconds
74         PROC PLOT DATA=RESIDSD;  PLOT E*YHAT='y' / VREF=0; RUN;
74       !                                                         OPTIONS PS=61;
NOTE: There were 14 observations read from the data set WORK.RESIDSD.
NOTE: The PROCEDURE PLOT printed page 19.
NOTE: PROCEDURE PLOT used:       real time           0.00 seconds
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on D with Diagnostics

The REG Procedure
Model: MODEL1

                                         Model Crossproducts X'X X'Y Y'Y
Variable       Label                               Intercept                D1                D2                 Y
Intercept      Intercept                                  14                 0                56            9638.7
D1             X - Xmean : Deviation units                 0                56                 0              3074
D2             D Squared                                  56                 0               392             37841
Y              Coffee sales (x 100 gals)              9638.7              3074             37841        6808491.07

                                    X'X Inverse, Parameter Estimates, and SSE
Variable       Label                               Intercept                D1                D2                 Y
Intercept      Intercept                        0.1666666667                 0      -0.023809524      705.47380952
D1             X - Xmean : Deviation units                 0      0.0178571429                 0      54.892857143
D2             D Squared                        -0.023809524                 0       0.005952381      -4.248809524
Y              Coffee sales (x 100 gals)        705.47380952      54.892857143      -4.248809524      679.22047619

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     2         171773          85887    1390.94    <.0001
Error                    11      679.22048       61.74732
Corrected Total          13         172453

Root MSE              7.85795    R-Square     0.9961
Dependent Mean      688.47857    Adj R-Sq     0.9953
Coeff Var             1.14135

                                        Parameter Estimates
                                                    Parameter       Standard
Variable     Label                          DF       Estimate          Error    t Value    Pr |t|
Intercept    Intercept                       1      705.47381        3.20799     219.91      <.0001
D1           X - Xmean : Deviation units     1       54.89286        1.05006      52.28      <.0001
D2           D Squared                       1       -4.24881        0.60625      -7.01      <.0001
 

The REG Procedure
Model: MODEL1
Dependent Variable: Y Coffee sales (x 100 gals)

                                                 Output Statistics
              Dep Var    Predicted       Std Error
     Obs            Y        Value    Mean Predict          95% CL Mean             95% CL Predict         Residual
       1     508.1000     502.5560          4.8500     491.8811     513.2308     482.2317     522.8802       5.5440
       2     498.4000     502.5560          4.8500     491.8811     513.2308     482.2317     522.8802      -4.1560
       3     568.2000     578.6929          2.9700     572.1559     585.2298     560.2035     597.1822     -10.4929
       4     577.3000     578.6929          2.9700     572.1559     585.2298     560.2035     597.1822      -1.3929
       5     651.7000     646.3321          2.9700     639.7952     652.8691     627.8428     664.8215       5.3679
       6     657.0000     646.3321          2.9700     639.7952     652.8691     627.8428     664.8215      10.6679
       7     713.4000     705.4738          3.2080     698.4131     712.5346     686.7928     724.1548       7.9262
       8     697.5000     705.4738          3.2080     698.4131     712.5346     686.7928     724.1548      -7.9738
       9     755.3000     756.1179          2.9700     749.5809     762.6548     737.6285     774.6072      -0.8179
      10     758.9000     756.1179          2.9700     749.5809     762.6548     737.6285     774.6072       2.7821
      11     787.6000     798.2643          2.9700     791.7273     804.8013     779.7749     816.7537     -10.6643
      12     792.1000     798.2643          2.9700     791.7273     804.8013     779.7749     816.7537      -6.1643
      13     841.4000     831.9131          4.8500     821.2383     842.5879     811.5888     852.2374       9.4869
      14     831.8000     831.9131          4.8500     821.2383     842.5879     811.5888     852.2374      -0.1131

Sum of Residuals                           0
Sum of Squared Residuals           679.22048
Predicted Residual SS (PRESS)     1106.76791

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on D with Diagnostics
                                                 Plot of E*X1.  Symbol used is 'x'.
               |
               |
            20 +
               |
               |
               |
               |
            10 +                                    x                                                                   x
         R     |                                                     x
         e     |  x                                 x
         s     |
         i     |                                                                      x
         d   0 +----------------------------------------------------------------------x---------------------------------x--
         u     |                   x
         a     |  x
         l     |                                                                                       x
               |                                                     x
           -10 +                   x                                                                   x
               |
               |
               |
               |
           -20 +
               |
               ---+----------------+----------------+----------------+----------------+----------------+----------------+--
                  0                1                2                3                4                5                6
                                                         X : Number of Dispensers

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on D with Diagnostics
                                                Plot of E*YHAT.  Symbol used is 'y'.
              |
              |
           20 +
              |
              |
              |
              |
           10 +                                              y                                                       y
        R     |                                                                y
        e     |   y                                          y
        s     |
        i     |                                                                               y
        d   0 +-------------------------------------------------------------------------------y----------------------y-------
        u     |                          y
        a     |   y
        l     |                                                                                           y
              |                                                                y
          -10 +                          y                                                                y
              |
              |
              |
              |
          -20 +
              |
              ---+--------------+--------------+--------------+--------------+--------------+--------------+--------------+--
                500            550            600            650            700            750            800            850
                                                            Predicted Value of Y
 
 

75         PROC REG DATA=ONE;
76               TITLE2 'Quadratic polynomial regression on X with Diagnostics';
77            MODEL  Y = X1 X2 / XPX I P CLM CLI; RUN;
NOTE: 14 observations read.
NOTE: 14 observations used in computations.
78               OUTPUT OUT=RESIDSX PREDICTED=YHAT RESIDUAL=E; OPTIONS PS=35; RUN;
NOTE: The data set WORK.RESIDSX has 14 observations and 24 variables.
NOTE: The PROCEDURE REG printed pages 20-22.
NOTE: PROCEDURE REG used:       real time           0.05 seconds
79         PROC PLOT DATA=RESIDSX;  PLOT E*X1='x' / VREF=0; RUN;
NOTE: There were 14 observations read from the data set WORK.RESIDSX.
NOTE: The PROCEDURE PLOT printed page 23.
NOTE: PROCEDURE PLOT used:       real time           0.00 seconds
80         PROC PLOT DATA=RESIDSX;  PLOT E*YHAT='y' / VREF=0; RUN;
80       !                                                         OPTIONS PS=61;
81
NOTE: There were 14 observations read from the data set WORK.RESIDSX.
NOTE: The PROCEDURE PLOT printed page 24.
NOTE: PROCEDURE PLOT used:       real time           0.05 seconds
 EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

The REG Procedure
Model: MODEL1

Model Crossproducts X'X X'Y Y'Y
Variable       Label                             Intercept                X1                X2                 Y
Intercept      Intercept                                14                42               182            9638.7
X1             X : Number of Dispensers                 42               182               882           31990.1
X2             X Squared                               182               882              4550          143033.3
Y              Coffee sales (x 100 gals)            9638.7           31990.1          143033.3        6808491.07

X'X Inverse, Parameter Estimates, and SSE
Variable       Label                             Intercept                X1                X2                 Y
Intercept      Intercept                       0.380952381      -0.232142857      0.0297619048      502.55595238
X1             X : Number of Dispensers       -0.232142857      0.2321428571      -0.035714286      80.385714286
X2             X Squared                      0.0297619048      -0.035714286       0.005952381      -4.248809524
Y              Coffee sales (x 100 gals)      502.55595238      80.385714286      -4.248809524      679.22047619

Analysis of Variance
                                    Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr F
Model                     2         171773          85887    1390.94    <.0001
Error                    11      679.22048       61.74732
Corrected Total          13         172453

Root MSE              7.85795    R-Square     0.9961
Dependent Mean      688.47857    Adj R-Sq     0.9953
Coeff Var             1.14135

Parameter Estimates
                                                  Parameter       Standard
Variable     Label                        DF       Estimate          Error    t Value    Pr |t|
Intercept    Intercept                     1      502.55595        4.85003     103.62      <.0001
X1           X : Number of Dispensers      1       80.38571        3.78605      21.23      <.0001
X2           X Squared                     1       -4.24881        0.60625      -7.01      <.0001
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

The REG Procedure
Model: MODEL1
Dependent Variable: Y Coffee sales (x 100 gals)

Output Statistics
         Dep Var    Predicted       Std Error
Obs            Y        Value    Mean Predict          95% CL Mean             95% CL Predict         Residual
  1     508.1000     502.5560          4.8500     491.8811     513.2308     482.2317     522.8802       5.5440
  2     498.4000     502.5560          4.8500     491.8811     513.2308     482.2317     522.8802      -4.1560
  3     568.2000     578.6929          2.9700     572.1559     585.2298     560.2035     597.1822     -10.4929
  4     577.3000     578.6929          2.9700     572.1559     585.2298     560.2035     597.1822      -1.3929
  5     651.7000     646.3321          2.9700     639.7952     652.8691     627.8428     664.8215       5.3679
  6     657.0000     646.3321          2.9700     639.7952     652.8691     627.8428     664.8215      10.6679
  7     713.4000     705.4738          3.2080     698.4131     712.5346     686.7928     724.1548       7.9262
  8     697.5000     705.4738          3.2080     698.4131     712.5346     686.7928     724.1548      -7.9738
  9     755.3000     756.1179          2.9700     749.5809     762.6548     737.6285     774.6072      -0.8179
 10     758.9000     756.1179          2.9700     749.5809     762.6548     737.6285     774.6072       2.7821
 11     787.6000     798.2643          2.9700     791.7273     804.8013     779.7749     816.7537     -10.6643
 12     792.1000     798.2643          2.9700     791.7273     804.8013     779.7749     816.7537      -6.1643
 13     841.4000     831.9131          4.8500     821.2383     842.5879     811.5888     852.2374       9.4869
 14     831.8000     831.9131          4.8500     821.2383     842.5879     811.5888     852.2374      -0.1131

Sum of Residuals                           0
Sum of Squared Residuals           679.22048
Predicted Residual SS (PRESS)     1106.76791
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

                                         Plot of E*X1.  Symbol used is 'x'.

       |
       |
    20 +
       |
       |
       |
       |
    10 +                                    x                                                                   x
 R     |                                                     x
 e     |  x                                 x
 s     |
 i     |                                                                      x
 d   0 +----------------------------------------------------------------------x---------------------------------x--
 u     |                   x
 a     |  x
 l     |                                                                                       x
       |                                                     x
   -10 +                   x                                                                   x
       |
       |
       |
       |
   -20 +
       |
       ---+----------------+----------------+----------------+----------------+----------------+----------------+--
          0                1                2                3                4                5                6
                                                 X : Number of Dispensers
 
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

                                        Plot of E*YHAT.  Symbol used is 'y'.

      |
      |
   20 +
      |
      |
      |
      |
   10 +                                              y                                                       y
R     |                                                                y
e     |   y                                          y
s     |
i     |                                                                               y
d   0 +-------------------------------------------------------------------------------y----------------------y-------
u     |                          y
a     |   y
l     |                                                                                           y
      |                                                                y
  -10 +                          y                                                                y
      |
      |
      |
      |
  -20 +
      |
      ---+--------------+--------------+--------------+--------------+--------------+--------------+--------------+--
        500            550            600            650            700            750            800            850
                                                    Predicted Value of Y
 
 
 
 

82         PROC UNIVARIATE DATA=RESIDSX NORMAL PLOT; VAR Y E; RUN;
NOTE: The PROCEDURE UNIVARIATE printed pages 25-28.
NOTE: PROCEDURE UNIVARIATE used:       real time           0.00 seconds
83         PROC UNIVARIATE DATA=RESIDSD NORMAL PLOT; VAR Y E; RUN;
NOTE: The PROCEDURE UNIVARIATE printed pages 29-32.
NOTE: PROCEDURE UNIVARIATE used:       real time           0.00 seconds
84         PROC PRINT DATA=RESIDSX; VAR Y X1 X2 X3 E YHAT;
85              TITLE2 'Raw Data Listing'; RUN;
NOTE: There were 14 observations read from the data set WORK.RESIDSX.
NOTE: The PROCEDURE PRINT printed page 33.
NOTE: PROCEDURE PRINT used:       real time           0.00 seconds
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

The UNIVARIATE Procedure
Variable:  Y  (Coffee sales (x 100 gals))

                            Moments
N                          14    Sum Weights                 14
Mean               688.478571    Sum Observations        9638.7
Std Deviation      115.176341    Variance            13265.5895
Skewness            -0.391266    Kurtosis            -1.0909201
Uncorrected SS     6808491.07    Corrected SS        172452.664
Coeff Variation    16.7291105    Std Error Mean      30.7821719

              Basic Statistical Measures
    Location                    Variability
Mean     688.4786     Std Deviation          115.17634
Median   705.4500     Variance                   13266
Mode        .         Range                  343.00000
                      Interquartile Range    210.30000

           Tests for Location: Mu0=0
Test           -Statistic-    -----p Value------
Student's t    t  22.36615    Pr |t|    <.0001
Sign           M         7    Pr = |M|   0.0001
Signed Rank    S      52.5    Pr = |S|   0.0001

                   Tests for Normality
Test                  --Statistic---    -----p Value------
Shapiro-Wilk          W     0.933908    Pr < W      0.3458
Kolmogorov-Smirnov    D      0.14767    Pr D     0.1500
Cramer-von Mises      W-Sq  0.047489    Pr W-Sq  0.2500
Anderson-Darling      A-Sq  0.327123    Pr A-Sq  0.2500

Quantiles (Definition 5)
Quantile      Estimate
100% Max        841.40
99%             841.40
95%             841.40
90%             831.80
75% Q3          787.60
50% Median      705.45
25% Q1          577.30
10%             508.10
5%              498.40
1%              498.40
0% Min          498.40

         Extreme Observations
-----Lowest----        ----Highest----
 Value      Obs         Value      Obs
 498.4        2         758.9       10
 508.1        1         787.6       11
 568.2        3         792.1       12
 577.3        4         831.8       14
 651.7        5         841.4       13

   Stem Leaf                     #  Boxplot                        Normal Probability Plot
      8 34                       2     |         825+                                   ++*++  *
      7 6699                     4  +-----+         |                            * *+*+*
      7 01                       2  *-----*         |                          *++++
      6 56                       2  |  +  |         |                    * *+*++
      6                             |     |         |                  ++++
      5 78                       2  +-----+         |             +++*+*
      5 01                       2     |            |         ++++*
      4                                          475+     +++*
        ----+----+----+----+                         +----+----+----+----+----+----+----+----+----+----+
    Multiply Stem.Leaf by 10**+2                         -2        -1         0        +1        +2
 
 
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

The UNIVARIATE Procedure
Variable:  E  (Residual)

                            Moments
N                          14    Sum Weights                 14
Mean                        0    Sum Observations             0
Std Deviation      7.22825905    Variance            52.2477289
Skewness           -0.0646111    Kurtosis            -1.2552095
Uncorrected SS     679.220476    Corrected SS        679.220476
Coeff Variation             .    Std Error Mean      1.93183349

              Basic Statistical Measures
    Location                    Variability
Mean      0.00000     Std Deviation            7.22826
Median   -0.46548     Variance                52.24773
Mode       .          Range                   21.33214
                      Interquartile Range     11.70833

           Tests for Location: Mu0=0
Test           -Statistic-    -----p Value------
Student's t    t         0    Pr |t|    1.0000
Sign           M        -1    Pr = |M|   0.7905
Signed Rank    S      -1.5    Pr = |S|   0.9515

                   Tests for Normality
Test                  --Statistic---    -----p Value------
Shapiro-Wilk          W     0.946329    Pr < W      0.5053
Kolmogorov-Smirnov    D     0.128287    Pr D     0.1500
Cramer-von Mises      W-Sq  0.031604    Pr W-Sq  0.2500
Anderson-Darling      A-Sq  0.240417    Pr A-Sq  0.2500

Quantiles (Definition 5)
Quantile        Estimate
100% Max       10.667857
99%            10.667857
95%            10.667857
90%             9.486905
75% Q3          5.544048
50% Median     -0.465476
25% Q1         -6.164286
10%           -10.492857
5%            -10.664286
1%            -10.664286
0% Min        -10.664286

            Extreme Observations
------Lowest------        ------Highest-----
    Value      Obs            Value      Obs
-10.66429       11          5.36786        5
-10.49286        3          5.54405        1
 -7.97381        8          7.92619        7
 -6.16429       12          9.48690       13
 -4.15595        2         10.66786        6

   Stem Leaf                     #  Boxplot                        Normal Probability Plot
      1 1                        1     |        12.5+                                       +++*+++
      0 5689                     4  +-----+         |                              * *+*++*+
      0 3                        1  |  +  |         |                         +++*+++
     -0 4110                     4  *-----*         |                   +*+*+* *
     -0 86                       2  +-----+         |            ++++*+*
     -1 10                       2     |       -12.5+     +++*+++ *
        ----+----+----+----+                         +----+----+----+----+----+----+----+----+----+----+
    Multiply Stem.Leaf by 10**+1                         -2        -1         0        +1        +2
 
 
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

The UNIVARIATE Procedure
Variable:  Y  (Coffee sales (x 100 gals))

                            Moments
N                          14    Sum Weights                 14
Mean               688.478571    Sum Observations        9638.7
Std Deviation      115.176341    Variance            13265.5895
Skewness            -0.391266    Kurtosis            -1.0909201
Uncorrected SS     6808491.07    Corrected SS        172452.664
Coeff Variation    16.7291105    Std Error Mean      30.7821719

              Basic Statistical Measures
    Location                    Variability
Mean     688.4786     Std Deviation          115.17634
Median   705.4500     Variance                   13266
Mode        .         Range                  343.00000
                      Interquartile Range    210.30000

           Tests for Location: Mu0=0
Test           -Statistic-    -----p Value------
Student's t    t  22.36615    Pr |t|    <.0001
Sign           M         7    Pr = |M|   0.0001
Signed Rank    S      52.5    Pr = |S|   0.0001

                   Tests for Normality
Test                  --Statistic---    -----p Value------
Shapiro-Wilk          W     0.933908    Pr < W      0.3458
Kolmogorov-Smirnov    D      0.14767    Pr D     0.1500
Cramer-von Mises      W-Sq  0.047489    Pr W-Sq  0.2500
Anderson-Darling      A-Sq  0.327123    Pr A-Sq  0.2500

Quantiles (Definition 5)
Quantile      Estimate
100% Max        841.40
99%             841.40
95%             841.40
90%             831.80
75% Q3          787.60
50% Median      705.45
25% Q1          577.30
10%             508.10
5%              498.40
1%              498.40
0% Min          498.40

         Extreme Observations
-----Lowest----        ----Highest----
 Value      Obs         Value      Obs
 498.4        2         758.9       10
 508.1        1         787.6       11
 568.2        3         792.1       12
 577.3        4         831.8       14
 651.7        5         841.4       13

   Stem Leaf                     #  Boxplot                        Normal Probability Plot
      8 34                       2     |         825+                                   ++*++  *
      7 6699                     4  +-----+         |                            * *+*+*
      7 01                       2  *-----*         |                          *++++
      6 56                       2  |  +  |         |                    * *+*++
      6                             |     |         |                  ++++
      5 78                       2  +-----+         |             +++*+*
      5 01                       2     |            |         ++++*
      4                                          475+     +++*
        ----+----+----+----+                         +----+----+----+----+----+----+----+----+----+----+
    Multiply Stem.Leaf by 10**+2                         -2        -1         0        +1        +2
 
 
 

EXST7034 - Example NWK Table 9.1 : Cafeteria Coffee sales
Quadratic polynomial regression on X with Diagnostics

The UNIVARIATE Procedure
Variable:  E  (Residual)

                            Moments
N                          14    Sum Weights                 14
Mean                        0    Sum Observations             0
Std Deviation      7.22825905    Variance            52.2477289
Skewness           -0.0646111    Kurtosis            -1.2552095
Uncorrected SS     679.220476    Corrected SS        679.220476
Coeff Variation             .    Std Error Mean      1.93183349

              Basic Statistical Measures
    Location                    Variability
Mean      0.00000     Std Deviation            7.22826
Median   -0.46548     Variance                52.24773
Mode       .          Range                   21.33214
                      Interquartile Range     11.70833

           Tests for Location: Mu0=0
Test           -Statistic-    -----p Value------
Student's t    t         0    Pr |t|    1.0000
Sign           M        -1    Pr = |M|   0.7905
Signed Rank    S      -1.5    Pr = |S|   0.9515

                   Tests for Normality
Test                  --Statistic---    -----p Value------
Shapiro-Wilk          W     0.946329    Pr < W      0.5053
Kolmogorov-Smirnov    D     0.128287    Pr D     0.1500
Cramer-von Mises      W-Sq  0.031604    Pr W-Sq  0.2500
Anderson-Darling      A-Sq  0.240417    Pr A-Sq  0.2500

Quantiles (Definition 5)
Quantile        Estimate
100% Max       10.667857
99%            10.667857
95%            10.667857
90%             9.486905
75% Q3          5.544048
50% Median     -0.465476
25% Q1         -6.164286
10%           -10.492857
5%            -10.664286
1%            -10.664286
0% Min        -10.664286

            Extreme Observations
------Lowest------        ------Highest-----
    Value      Obs            Value      Obs
-10.66429       11          5.36786        5
-10.49286        3          5.54405        1
 -7.97381        8          7.92619        7
 -6.16429       12          9.48690       13
 -4.15595        2         10.66786        6

   Stem Leaf                     #  Boxplot                        Normal Probability Plot
      1 1                        1     |        12.5+                                       +++*+++
      0 5689                     4  +-----+         |                              * *+*++*+
      0 3                        1  |  +  |         |                         +++*+++
     -0 4110                     4  *-----*         |                   +*+*+* *
     -0 86                       2  +-----+         |            ++++*+*
     -1 10                       2     |       -12.5+     +++*+++ *
        ----+----+----+----+                         +----+----+----+----+----+----+----+----+----+----+
    Multiply Stem.Leaf by 10**+1                         -2        -1         0        +1        +2