Solutions HW 3
1a. (1/2, 1/2, -1/2, -1/2) or (1, 1, -1, -1)
b. (1, -1, 0, 0)
c. (0, 0, 1, -1)
d. H0: (mu1 + mu2)/2 = (mu3 + mu4)/2 or mu1 + mu2 = mu3 + mu4
or mu1 + mu2 – mu3 – mu4 = 0
HA: (mu1 + mu2)/2 is not equal to (mu3 + mu4)/2 or
mu1 + mu2 not equal mu3 + mu4 or
mu1 + mu2 – mu3 – mu4 not equal 0
t = (mu1 + mu2 – mu3 – mu4)/sqrt(MSE*SUM(ki^2/ri))
t = (72 + 85 – 76 – 62)/sqrt(100.9*(1/6 + 1/6 + 1/6 + 1/6)) = 2.32
t = 2.32 with 20 df
two-sided p-value < 0.05
We reject the null hypothesis and say there is significant evidence that the
mean of the animal fat means is greater than the mean of the vegetable fat means.
e. estimate: 85 – 72 = 13
t(0.025,20) = 2.086
SE: sqrt(MSE*(1/6 + 1/6)) = 5.8
95% CI: estimate +/- t*SE = 13 +/- 2.086*5.8 = 13 +/- 12.1
The 95% confidence interval for the difference between animal fats is
0.9 to 25.1.
f. contrast a: [(72 + 85 + (-1)76 + (-1)62)^2]/[1/6 + 1/6 + (-1^2)/6 + (-1^2)/6] = 541.5
contrast b: [(72 – 85 + 0 + 0)^2]/[1/6 + (-1^2)/6 + 0 + 0] = 507
contrast c: [(0 + 0 + 76 – 62)^2]/[0 + 0 + 1/6 + (-1^2)/6] = 588
g. MS(a) = 541.5/1 = 541.5 F = 541.5/100.9 = 5.37 p-value = 0.0313
MS(b) = 507/1 = 507 F = 507/100.9 = 5.02 p-value = 0.0365
MS(c) = 588/1 = 588 F = 588/100.9 = 5.83 p-value = 0.0255
Note: The F df are 1 and 20. Students are not expected to compute the exact p-
value but only to provide approximations based on the tables in the back of the
text. For example, it would be sufficient to say that all the p-values are
between 0.01 and 0.05.
Thus, all the contrasts reject the null hypothesis at the 0.05 level.
(a) There is significant evidence that the mean of the animal fat means does not
equal the mean of the vegetable fat means.
(b) There is significant evidence that the mean of animal fat 1 does not equal
the mean of animal fat 2.
(c) There is significant evidence that the mean of vegetable fat 1 does not
equal the mean of vegetable fat 2.
h. The test statistic t^2 = F. (2.32^2 = 5.37) These are equivalent tests.
i. (a) to (b): [(1*1)/6 + (1*-1)/6 + (-1*0)/6 + (-1*0)/6] = 0
(a) to (c): [(1*0)/6 + (1*0)/6 + (-1*1)/6 + (-1*-1)/6] = 0
(b) to (c); [(1*0)/6 + (-1*0)/6 + (0*1)/6 + (0*-1)/6] = 0
j. F = [(SS(a) + SS(b) + SS(c))/3]/MSE = [(541.5 + 507 + 588)/3]/100.9 = 5.41
F = 5.41 with 3 and 20df.
p-value = 0.0069
Thus, reject the null hypothesis and say that at least one contrast does not
equal zero.
k. These tests are equivalent, since the three orthogonal contrasts completely
partitioned the treatment sum of squares. Note that all three contrasts equal
0 if and only if all four means are equal to each other.
2a. The experimental units are ponds.
b. The observational units are fish or sets of 20 fish if fish are weighed in
groups of 20 rather than individually.
c. proc glm;
class density;
model weight = density;
run;
The GLM Procedure
Dependent Variable: weight
Sum of
Source DF Squares Mean Square F Value Pr > F
Model 4 1012.083000 253.020750 35.16 <.0001
Error 15 107.935000 7.195667
Corrected Total 19 1120.018000
F = 35.16 with 4 and 15 df.
p-value < 0.0001
There is significant evidence that stocking density affects catfish growth.
d) data one;
input density weight;
cards;
linear=density;
quadratic=density**2;
cubic=density**3;
quartic=density**4;
cards;
run;
proc glm;
model weight=linear quadratic cubic quartic;
run;
The GLM Procedure
Dependent Variable: weight
Source DF Type I SS Mean Square F Value Pr > F
linear 1 912.9802500 912.9802500 126.88 <.0001
quadratic 1 93.8616071 93.8616071 13.04 0.0026
cubic 1 2.4010000 2.4010000 0.33 0.5721
quartic 1 2.8401429 2.8401429 0.39 0.5393
The sum of squares, F-statistics and p-values are in the table above.
e) proc reg;
model weight=linear quadratic;
run;
The REG Procedure
Model: MODEL1
Dependent Variable: weight
Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 36.66000 2.76695 13.25 <.0001
linear 1 2.99036 2.10860 1.42 0.1742
quadratic 1 -1.29464 0.34479 -3.75 0.0016
The regression function is Yhat = B0 + B1*X + B2*X^2.
The estimates of the partial regression coefficients are B0 = 36.7, B1 = 3,
B2 = -1.3.
f) Intercept: t = 13.25, p-value < 0.0001, there is evidence that the intercept
is significantly different from zero.
Linear: t = 1.42, p-value = 0.1742, there is no evidence that the linear
coefficient is significantly different from zero. B1 may equal zero.
Quadratic: t = 3.75, p-value = 0.0016, there is evidence that the quadratic
coefficient is significantly different from zero.
g. SSE(reduced) = 113.18, df = 17
SSE(full) = 107.94, df = 15
F = [(113.18 – 107.94)/(17 – 15)]/(107.94/15) = 0.36 with 2 and 15 df.
p-value > 0.05
There is no evidence to reject the null that the quadratic regression function
(reduced model) adequately fits the data.
This test could also be obtained automatically using the code
proc glm;
class lack_of_fit;
model weight=linear quadratic lack_of_fit;
run;
where lack_of_fit is defined to equal density in the data step. See the
"lack_of_fit" line in the output below.
Source DF Type I SS Mean Square F Value Pr > F
linear 1 912.9802500 912.9802500 126.88 <.0001
quadratic 1 93.8616071 93.8616071 13.04 0.0026
lack_of_fit 2 5.2411429 2.6205714 0.36 0.7007