Statistics 104, Homework 4
Due : February 14th, 2018, In Class
This homework is to practice more on con dence interval and to practice permutation tests. R
codes need to be attached. Total: 90 points.
1. (30 points) Understand con dence interval better through simulations. Suppose you are pro-
vided with 25 observations (Y1;Y2;:::;Y25) and are asked to construct the 90% con dence
interval for 0:7, the 70th percentile of the population distribution. Based on Midterm 1, we
know that we would like to use Y(14) and Y(22) to construct the con dence interval. However,
there are two other choices that seem also not bad: (Y(12);Y(21)), and (Y(15);Y(24)).
Suppose the 25 observations are randomly drawn from a uniform. distribution, U([0,10]), i.e.,
the probability density function is f(y) =
0:1 0 y 10
0 otherwise .
(a) What is the 70th percentile of U([0;10])?
(b) Randomly generate 25 observations from the distribution, construct the three con dence
intervals. Repeat it for B = 10;000 times. Among the B con dence intervals based on
(Y(14);Y(22)), what is the percentage of intervals covering the true 0:7 you obtained in
(a)? Does it ful ll the requirement of 90%? Answer the same questions for intervals
based on (Y(12);Y(21)), and (Y(15);Y(24)), respectively.
(c) For the B intervals based on (Y(14);Y(22)), compute the average length. Do the same for
intervals based on (Y(12);Y(21)), and (Y(15);Y(24)). Among the three, which one has the
smallest average length?
2. (60 points) Two-sample permutation test. A biologist examined the e ect of a fungal infection
on the eating behavior. of rodents. Among twelve rodents, eight are randomly chosen and
provided with infected apples (Experiment) and the rest four are provided with sterile apples
(Control). The amounts consumed (grams of apple/kilogram of body weight) are listed in
the following table.
Experimental Group 11, 33, 48, 34, 112, 369, 64, 44
Control Group 177, 80, 141, 332
Let 1 and 2 be the population mean consumption of the experimental group and control
group, respectively. We would like to conduct the hypothesis testH0 : 1 = 2 vsHa : 1 < 2
at 0.05 signi cance level. Perform. the permutation test for each of the following six test
statistics. For each test statistic, use R to get the permutation distribution of the statistic,
state how the p-value shall be computed, report the exact p-value, and draw your conclusion.
(a) Mean di erence of the two groups.
(b) Sum of the experimental group.
(c) Median di erence of the two groups.
(d) Rank the pooled data from both groups and use mean di erence based on the ranks.
(e) Rank the pooled data from both groups and use sum of ranks in the experimental group.
(f) The Mann-Whitney statistic: the number of pairs (Xi;Yj) for which Xi 1