options ls=80 ps=60 nodate;

data cheese;
input taste acetic h2s lactic;
cards;
12.3 4.543 3.135 0.86
20.9 5.159 5.043 1.53
39.0 5.366 5.438 1.57
47.9 5.759 7.496 1.81
5.6  4.663 3.807 0.99
25.9 5.697 7.601 1.09
37.3 5.892 8.726 1.29
21.9 6.078 7.966 1.78
18.1 4.898 3.850 1.29
21.0 5.242 4.174 1.58
34.9 5.740 6.142 1.68
57.2 6.446 7.908 1.90
0.7  4.477 2.996 1.06
25.9 5.236 4.942 1.30
54.9 6.151 6.752 1.52
40.9 6.365 9.588 1.74
15.9 4.787 3.912 1.16
6.4  5.412 4.700 1.49
18.0 5.247 6.174 1.63
38.9 5.438 9.064 1.99
14.0 4.564 4.949 1.15
15.2 5.298 5.220 1.33
32.0 5.455 9.242 1.44
56.7 5.855 10.20 2.01
16.8 5.366 3.664 1.31
11.6 6.043 3.219 1.46
26.5 6.458 6.962 1.72
0.7  5.328 3.912 1.25
13.4 5.802 6.685 1.08
5.5  6.176 4.787 1.25
;

/* Examples 6.2, 6.3, 6.4, and 6.5.
xpx = X'X matrix
i = inverse of X'X
covb = MSE * inverse of X'X (i.e., the estimated cov. matrix of beta-hat)
clb = gives confidence intervals for each regression parameter */

proc reg;
model taste = acetic h2s lactic/xpx i covb clb;
run;

/* Examples 6.6 and 6.7.
Illustration of sequential and partial SS */

proc glm;
model taste = acetic h2s lactic;
run;

proc glm;
model taste = h2s lactic acetic;
run;

/* Examples 6.8 and 6.9.
Confidence intervals and prediction intervals */

data proposed;
input taste acetic h2s lactic;
lines;
. 5 6 1
;
run;
data both;
set cheese proposed; /* merging two datasets */
run;
proc reg data=both;
model taste = acetic h2s lactic/clm cli;
run;

/* Examples 6.10 and 6.11.
Reduced versus full model testing */

proc reg;
model taste = acetic h2s lactic; /* full model */
title 'FULL MODEL';
run;

proc reg;
model taste = lactic; /* reduced model */
title 'REDUCED MODEL';
run;