Professional Documents
Culture Documents
Solutions To Homework 6: Stat 24500: Winter 2006
Solutions To Homework 6: Stat 24500: Winter 2006
Solutions to Homework 6
Also,
I J
IJ 1
lσ 2 = − 2
+ (Yij − μi )2
2σ 2(σ 2 )2
i=1 j=1
⎛ ⎞
I J
1 ⎝
= (Yij − μi )2 − IJσ 2 ⎠ .
2(σ 2 )2
i=1 j=1
To get the critical points we set all these partial derivative equal to 0 at the same time and solve
the resulting system of equations. For each i = 1, . . . , I we have
J
1
μ̂i = Yij = Ȳi· .
J
j1
Therefore, using values of μ1 , . . . , μI other than μ̂1 , . . . , μ̂I can only decrease l. Having that, we
can consider l(μ̂1 , . . . , μI , ·) as a function only of σ 2 ; we can easily see that lσ2 (σ 2 ) is positive for
σ 2 < σ̂ 2 and negative for σ 2 > σ̂ 2 , so this critical point is actually the MLE.
(Y − μ)2
1 1 i=1 j=1 ij
lik(μ, σ 2 ) = exp − .
(2π)IJ/2 σ −IJ 2σ 2
Notice that this is exactly the same setup for finding the MLEs for i.i.d. normals, since all the
means are the same. We know what the MLEs are for this case (see the Notes on Normal MLEs
in the Chalk Class Documents):
I J
1
μ̂0 = Yij = Ȳ··
IJ
i=1 j=1
and
I J
1
σ̂02 = (Yij − Ȳ·· )2
IJ
i=1 j=1
Now we plug these values back into Λ. The result of plugging-in either of σ̂ 2 or σ̂02 into the
exponential part yields e−IJ/2 ; these parts cancel out, as do the constants (2π)−IJ/2 , leaving
2 −IJ/2 I 2
IJ/2
σ̂ i=1 (Yi· − Ȳ·· )
Λ= = 1 + J I J .
σ̂02 i=1 j=1 (Y ij − Ȳi· )2
The LRT rejects H0 if Λ is large; that is, if Λ > c for a cutoff point c ≥ 0 that satisfies
Prob[Λ > c | H0 ] ≤ α,
where α is the specified significance level. We have to show that this test is equivalent to an F -test.
Indeed, raising Λ to the power 2/IJ, subtracting 1, and multiplying by the appropriate ratio of
integers to obtain the correct degrees of freedom (all these operations preserve order), we obtain
that Λ > c is equivalent to
I 2
i=1 (Yi· − Y·· ) /(I − 1)
I J
> c
(Y − Y )2 /(I(J − 1)
i=1 j=1 ij i·
I
αi = μi − μi , for i = 1, . . . , I,
i=1
and σ remains unchanged, the MLEs are obtained by transforming the MLEs obtained in (a) in
the same way:
I I
1 1
μ̂ = μ̂i = Ȳi· = Ȳ·· ,
I I
i=1 i=1
Finding these MLEs can also be attempted directly, but the computations involved range from
complicated to very complicated.
We restrict our data set to consider only labs 1, 4, 5, and 6; c.f. Example A of Section 12.2.2.1
in Rice (depending on your interpretation of the problem, you might also use the whole data set;
that can give you a different estimate of variability, in particular since you will have to use the t
distribution with 63 degrees of freedom instead of 36, as below, and the whole pooled standard
error).
Lab Mean
1 4.062
4 3.920
5 3.957
6 3.955
Thus, the means are unchanged; however, the pooled standard error is different from the one in
the book (since we have fewer data): sp = 0.0498.
There are 3 comparisons to be made. Let’s say that we want the confidence level to be 95% for
all the intervals simultaneously. Following the Bonferroni method, we take α = 0.05/3 = 0.0167.
Then each interval is given by:
2
(Ȳi1 · − Ȳi2 · ) ± sp t36,0.025/3
10
The simultaneous confidence intervals are:
Comparison Lower Upper
μlab1 − μlab4 0.0861 0.1979
μlab1 − μlab5 0.0491 0.1609
μlab1 − μlab6 0.0511 0.1629
REMARK: If you interpreted the question as asking for CI’s for all the pairwise comparisons among
the for labs considered, then you will have 6 comparisons. That means that you should use t36,0.025/6
in order to get the desired significance level for all the comparisons simultaneously.
First, the p-value for Dosage associated with the two-way ANOVA table at the top of page 464 in
Rice is 7.9 × 10−9 .
To compute the one-way ANOVA table for Dosage, we pass the sums of squares corresponding to
Iron form and to the interaction into the error SS; we can do that because of the algebraic identity
which holds here because the design is balanced (all cells have the same number of observations).
The degrees of freedom for Dosage remain the same, but the error gains 3 degrees of freedom.
Using this information we can compute the mean sums of squares, the F statistics and the p-values
to complete the new table:
Notice that the new p-value is approximately twice as large as the p-value for the two-way ANOVA
(although it is still extremely small). This is due to the fact that, by disregarding Iron form and the
interaction term, we increased the error SS more than necessary to compensate for the increased
error degrees of freedom. In the two-way table, inferences about Dosage are adjusted for the effect
of the iron form, while the one-way table there is no such adjustment.
The table below contains the original data and the marginal averages:
Ȳi·
4.4 4.3 4.0 3.6 3.3 3.92
4.1 4.1 4.0 4.0 3.9 4.02
3.2 3.9 3.8 4.1 4.4 3.88
3.9 4.0 3.8 4.1 4.4 4.04
Ȳ·j 3.9 4.08 3.9 3.95 4.0 3.97 = Ȳ··
μ̂ = 3.97
α1 = 3.92 − 3.965 = −0.045
α2 = 4.02 − 3.965 = 0.055
α3 = 3.88 − 3.965 = −0.085
α4 = 4.04 − 3.965 = 0.075
β1 = 3.9 − 3.965 = −0.065
β2 = 4.075 − 3.965 = 0.11
β3 = 3.9 − 3.965 = −0.065
β4 = 3.95 − 3.965 = −0.015
β5 = 4.0 − 3.965 = 0.035
As you can observe, the residuals are, in general, larger by about one order of magnitude than the
estimated row and column effects. This indicates that those effects are not significant.
First, we enter the data in the form of columns of a data frame (this can be done by hand). Here
is a print-out of how the data is organized:
summary(a)
(I am including the whole output here, but you are not required to, and in fact, are encouraged to
delete unnecessary information when you decide to include R output in your report).
Remark: The term poison:treatment in the model formula inside aov refers to the interaction
term.
As you can see from the output, both the poison and treatment effects appear to be significant, yet
the interaction term is not.
The observations in the previous paragraph cast some doubts on the computed p-values. However,
the p-values are so small that the conclusions about significant effects might still hold. Furthermore,
moderate violations of the normality assumption or (especially in the case when the number of
observations in each group is the same) the constant variance assumption, do not affect the F test
strongly (see Rice, page 450).
● ●
4
4
● ●
● ●
2
● ●
Sample Quantiles
● ● ● ●
Residuals
● ●
●● ● ●
●● ● ● ●● ●
● ● ●
●●●● ● ●
● ●
●●● ● ● ●
●●●● ● ● ● ●
●●● ● ●
0
●
●● ● ●
●● ●● ● ●
●●● ●
● ●
●● ● ●
● ●
●● ● ●
● ●
● ●
● ● ● ●
−2
−2
● ●
● ●
● ●
−2 −1 0 1 2 2 3 4 5 6 7 8 9
Figure 1: Diagnostic plots for the analysis of variance in Problem 5, using the original time data
(not transformed): on the left, a normal probability plot of the residuals; on the right, the residuals
plotted vs. the fitted values.
However, if we use the logarithm to transform the time data, we obtain similar results from the anal-
ysis of variance (regarding the significance of the different terms, not the values of the coefficients),
and we obtain better (although not perfect) behavior from the residuals:
● ● ● ●
0.4
0.4
● ●
●● ● ●
0.2
0.2
Sample Quantiles
● ●
●● ● ●
● ● ●
●●●● ● ● ●
●●●●● ●● ●
Residuals
● ●
● ●
●●● ● ● ●
●● ● ●
0.0
0.0
●●● ● ● ●
● ●
●●● ● ● ●
●●● ● ●●
●● ● ●
●● ● ●
−0.2
−0.2
● ●
●● ● ●
● ●
● ●
●● ● ●
● ●
−0.4
−0.4
● ●
● ●
Figure 2: Diagnostic plots for the analysis of variance in Problem 5, using the log-transformed time
data: on the left, a normal probability plot of the residuals; on the right, the residuals plotted
vs. the fitted values.
Appendix to Problem 6: The R instructions used to create Figue 1 (you do not have to include
this sort of information in your reports).
postscript("hw6_sol_plots.eps")
par(mfrow=c(1,2)) # splitting the plotting area in two
qqnorm(a$res)
plot(a$fit,a$res,xlab="Fitted values",ylab="Residuals")
dev.off() # saving the file with the picture