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 &n