Dear all, this homework is due before class on Tuesday, February 25, 2024. Please
submit it to SBU Brightspace. Quiz 2 of similar content (please review the entire lecture
notes 4 and 6), will be given in class, and in-person, on Thursday, February 27. It will be
a close book exam – but you can have 3 pages (8x11) of double-sided formula sheet, plus
a non-programmable calculator. (Most of our quizzes will be on R programming and will
be open book exams – only the first few quizzes will be close book exams. At least the 3
lowest 3 quiz scores will be dropped for each student when computing the final quiz
scores – so no worries if you did not do well in a few quizzes.)
1. To determine whether glaucoma affects the corneal thickness, measurements were
made in 8 people affected by glaucoma in one eye but not in the other. The corneal
thickness data (in microns) were as follows:
Person 1 2 3 4 5 6 7 8
Eye affected 488 478 480 426 440 410 458 460
Eye not affected 484 478 492 444 436 398 464 476
(a) According to the data, can you conclude, at the significance level of 0.10, that the
corneal thickness is not equal for affected versus unaffected eyes? Calculate a 90%
confidence interval for the mean difference in thickness.
(b) Please answer the same question in (a) using R programming. Please be sure to
include the Shapiro-Wilk test for the normality of the paired differences.
Solution: This problem involves a paired sample – and once we take the paired
difference, it will reduce to the inference on one population mean, here being the mean
difference of corneal thickness for those affected versus those not affected.
The paired difference is calculated as follows:
Person 1 2 3 4 5 6 7 8
Eye affected 488 478 480 426 440 410 458 460
Eye not affected 484 478 492 444 436 398 464 476
Difference (d) 4 0 -12 -18 4 12 -6 -16
(a) Using the paired differences, this reduce to a one population mean problem. The
sample statistics are: d = −4 and s d = 10.744 . Assuming the paired differences follow
a normal distribution. We are performing a two-sided t-test (per the context of this
question): 𝐻0 : 𝜇𝑑 = 0 versus 𝐻𝑎 : 𝜇𝑑 ≠ 0
The test statistic (this is the pivotal quantity with the null value for the parameter
of interest, 𝜇𝑑 = 0, plugged in) is
d −0 −4−0
t= = = −1.053
s d n 10.744 8
Page 1 of 6
, AMS 580.1 Homework #2 Name: ID:
Since t t8−1,0.05 = 1.895 , we can NOT reject H 0 at = 0.10 . That is, we do NOT have
enough evidence to support the claim that the average corneal thicknesses are affected by
glaucoma.
Under the same normality assumption, a 90% CI for 𝜇𝑑 = 𝜇1 − 𝜇2 is given by
d tn−1, 2 sd n = −4 1.895 10.744 8
That is, [−11.198, 3.198]
(In fact, since 𝜇𝑑 = 0 is inside this 90% CI, we can not reject the corresponding two-
sided null hypothesis 𝐻0 : 𝜇𝑑 = 0 versus 𝐻𝑎 : 𝜇𝑑 ≠ 0 at the same significance level 𝛼 =
0.1).
(b)
data_affected = c(488, 478, 480, 426, 440, 410, 458, 460)
data_not_affected = c(484, 478, 492, 444, 436, 398, 464, 476)
difference = data_affected - data_not_affected
shapiro.test(difference)
##
## Shapiro-Wilk normality test (*the null hypothesis is the population
is normal)
##
## data: difference
## W = 0.94404, p-value = 0.6512 (*We reject the null hypothesis if the
p-value is smaller than the significance level given.)
# p-value = 0.6512, which is larger than 0.05, so we can not reject the
null hypothesis that the difference is normally distributed
# Method 1: step by step
mean_diff = mean(difference)
std_diff = sd(difference)
t_stat = mean_diff / (std_diff / sqrt(length(difference)))
t_stat
## [1] -1.053048
alpha = 0.10
t_critical = qt(1 - alpha/2, df = length(difference) - 1)
margin_of_error = t_critical * (std_diff / sqrt(length(difference)))
ci_lower = mean_diff - margin_of_error
ci_upper = mean_diff + margin_of_error
ci_lower
## [1] -11.19655
ci_upper
Page 2 of 6