Lab Test 2018 Answers PDF
Lab Test 2018 Answers PDF
Name:
Student Number:
Tutor:
Instructions:
❼ This test contains 2 problems, worth a total of 25 marks.
❼ This test will be conducted under examination conditions: you are not allowed to talk
until after you leave the room. You must work individually.
❼ This is an open book test: you may use any printed or hand-written materials. Electronic
devices (including, but not limited to, calculators and mobile phones) are not permitted
and will be confiscated.
❼ Write your answers in the spaces provided. You will need to use R to produce graphs
and statistics in order to answer the questions on this test. You DO NOT need to write
down your commands, or copy any graphs which you produce.
❼ You may only use R and RStudio. Internet access and all other software, including Excel,
are NOT PERMITTED.
❼ You are allowed to use your lecture notes, annotated computer lab sheets and any other
printed or written notes.
❼ You have 40 minutes to complete the test.
Test Number 1
Solution: X is clearly right-skewed. This can be seen by the fact that its mean (1.56, below) is
larger than its median (1). 1 mark for right-skewed, 1 mark for justification.
c. [2 marks] In a family with 4 children, what is the probability that exactly 1 will have more than
1 episode of otitis media in the first 2 years of their life?
[1] 0.2897338
d. [3 marks] From the distribution above, it can be calculated that E(X) = 1.56 and sd(X) = 1.023.
In a town of 5000 babies, calculate a 95% probability interval for the total number of episodes of
otitis media for all of these babies.
> qnorm(c(0.025,0.975),5000*1.56,1.023*sqrt(5000))
Solution: (7658, 7942). 1 mark for normal, 1 mark for correct mean/sd, 1 mark for correct
answer.
e. [3 marks] In a study of 200 babies in New Zealand, it was found that 79 of them had more than 1
episode of otitis media in the first 2 years of their life. Test the hypothesis that there is a different
proportion of such babies in New Zealand than in Australia, at the 5% significance level. Clearly
state your hypotheses, p-value and conclusion in the context of the problem.
Solution: We test H0 : pNZ = 0.46 against H1 : pNZ 6= 0.46. With a p-value of 0.076, we do not
reject H0 : there is insufficient evidence to show that New Zealand has a different proportion of
these babies. 1 mark for hypotheses, 1 mark for p-value, 1 mark for conclusion in context.
data: redchol
t = -2.7829, df = 11, p-value = 0.01781
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-15.103220 -1.763446
sample estimates:
mean of x
-8.433333
Solution: (-15.10, -1.76). 1 mark for t-test, 1 mark for answer.
b. [2 marks] What distributional assumption are you making to answer part (a)? Produce an ap-
propriate plot on-screen to check this assumption, and comment on your findings.
> qqnorm(redchol)
> qqline(redchol)
● ●
5
●
0
Sample Quantiles
−5
●
−10
● ●
●
−15
●
●
−20
● ●
Theoretical Quantiles
Solution: We assume that the difference in cholesterol levels of the RedChol group is normal.
From the QQ plot, this does not seem unreasonable. 1 mark for normal assumption, 1 mark for
QQ plot.
c. [3 marks] Calculate a 95% prediction interval for the reduction in cholesterol for someone taking
the RedChol treatment.
Solution: (-32.48, 15.62). 1 mark for mean/sd, 1 mark for formula, 1 mark for answer.
d. [3 marks] Test the hypothesis that RedChol is as effective as a placebo for reducing cholesterol,
at the 5% significance level. Clearly state your hypotheses, p-value and conclusion in the context
of the problem.
e. [3 marks] The makers of RedChol claim that it reduces cholesterol levels by an average of
12mg/100mL in three months. The makers of a rival drug, BlueChol, claim that RedChol reduces
cholesterol levels by only 8mg/100mL. Calculate the sample size needed to distinguish between
these claims with power 0.9 and significance 0.05.
> library(pwr)
> pwr.t.test(d=4/sd(redchol), sig.level=0.05, power=0.9, type=✬one.sample✬)
n = 74.31763
d = 0.3810377
sig.level = 0.05
power = 0.9
alternative = two.sided
Solution: We require a sample of size at least 75. 1 mark for t-test, 1 mark for some right
arguments, 1 mark for correct answer.