Looking for a Statistics and RStudio expert!
Practice Exam 161.111
4 parts worth a total of 50 marks
Part A [12 marks in total]
A recent study reported that New Zealand smart phone subscribers averaged 4.3 hours per week watching videos on their smart phones. A film studies lecturer wanted to do a hypothesis test to find out if this average is true for New Zealand university students or not. She asked all the students in her large first year film studies class at Massey University how many hours they spent watching videos on their smart phones during the previous week. 50 students responded. Summary statistics (in hours per week) for the data are:
Sample mean = 6.99 Sample standard deviation = 3.35 Standard error = 0.4742
1) Explain why a one-sample t-test is appropriate for this data. [1 mark]
One-sample t-test as there is only 1 sample and 1 mean that we are interested in.
2) State the null hypothesis for this test. [1 mark]
The true mean time that New Zealand university students spend watching videos on their smart phones is 4.3 hours per week.
3) Calculate the test statistic for this hypothesis test. The formula is given below. [1 mark]
𝑡𝑡 = (𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠𝑚𝑚− 𝐻𝐻𝐻𝐻𝑠𝑠𝐻𝐻𝐻𝐻ℎ𝑠𝑠𝑠𝑠𝑒𝑒𝑠𝑠𝑠𝑠𝑒𝑒 𝑠𝑠𝑠𝑠𝑠𝑠𝑚𝑚) 𝑆𝑆𝑆𝑆
= [ ]−[ ] [ ]
=
= (6.99−4.3) 0.4742
= 5.6727 4) The p-value for the hypothesis test is 7.565e-07. State the decision with reason. [1 mark]
We decide in favour of the alternative as the p-value is less than 0.05
5) State the conclusion for this hypothesis test. [1 mark]
We have evidence to suggest that the true mean time that New Zealand university student spend watching videos on their smart phones is not 4.3 hours per month.
6) Are the conditions for this hypothesis test met? Explain. [2 marks]
The Sample size is 50 so CLT holds. This means that the sampling distribution should be normal.
The sample may not be representative of the population, as the sample was not chosen randomly. Students in a large first year film studies course may not be representative of all New
Zealand university students.
[Need to state if each condition is met and explain why or why not]
7) Calculate a 95% confidence interval for the average time New Zealand university students spend
watching videos on their smart phones. [2 marks]
Sample mean ± 2 x SE = 6.99 + 2 x 0.4742 = 6.99 + 0.9484
Lower limit = 6.99 – 0.9484 = 6.0416
Upper limit = 6.99 + 0.9484 = 7.9384
8) Explain how the confidence interval adds to your conclusion. [1 mark]
The CI adds to the conclusion by telling us that New Zealand university student spend more than 4.3 hours per week watching videos on their smart phones (somewhere between 6.04 and 7.94 hours per week).
9) The lecturer wondered if she should have selected her sample some other way. Discuss
problems with her sampling method. [2 marks] The sample was selected from one first year class so may not be representative of uni students more widely. Also it was not randomly selected so may not even be representative of that class.
Part B [11 marks in total] Researchers were interested in the effect of flower colour on insect pollination. They counted the number of insects from three different species (Beetles, Flies and Bees/Wasps) that visited white, yellow and blue flowers during a 24hour period. The table and graph below summarise their results.
Flower Colour White Yellow Blue Total Type of insect Beetles 56 34 12 102
Flies 31 74 22 127 Bees/Wasps 57 103 175 335
Total 144 211 209 564
1) The researchers suspected that the different coloured flowers will attract different types of
insect. Does the table or graph show this more clearly? Explain. [2 marks] The table is of counts, and it has quite different total numbers, so we cannot easily compare numbers. The graph shows proportions enabling us to compare the makeup of the different groups. So the graph shows this more clearly.
RStudio was used to do a Chi-squared test on this data. The RStudio output for the test, the expected counts and the residuals are below.
White Yellow Blue
Beetles Flies Bees/Wasps
Flower Colour
P ro
po rti
on
0. 0
0. 2
0. 4
0. 6
0. 8
1. 0
2) State the null hypothesis for this Chi-squared test. [1 mark]
The type of insect that visits the flower is independent of the colour of the flower.
3) What is the value of the test statistic? [1 mark]
115.03
4) State the decision for this hypothesis test with reason. [1 mark]
We decide in favour of the alternative as the p-value is less than 0.05.
5) State the conclusion for this hypothesis test. [1 mark]
There is evidence to suggest that the type of insect that visits a flower depends on the colour of the flower.
6) The expected counts are given in the output at the top of this page. Show how to calculate the
expected count for flies on yellow flowers. [1 mark] (127 x 211) / 564 = 47.51
7) Are the conditions for this hypothesis test met? Justify your answer. [2 marks] The smallest expected count is 26.04 which is greater than 5, so this condition is met.
However, the insects and flowers were only observed. No randomisation was used, so we cannot
guarantee that the data is representative of the population. So this condition is not satisfied.
[Need to state if each condition is met and explain why] 8) Do the residuals add to the conclusion or just confirm it? Explain. [1 mark]
The residuals do add to the conclusion as they indicate that more bees/wasps were observed
visiting blue flowers than we would expect if there was no relationship (a residual of 4.56) and
that more beetles were observed visiting white flowers than expected (a residual of 5.87).
9) A biologist questions the need for the Chi-squared test. He says the conclusion is obvious from
looking at the graph and table of the data. Explain why the chi-squared test is important. [1 mark]
Although the table and graph are suggestive of a relationship between the type of insect visiting a flower and the colour of the flower, this is only for the sample data. To be able to generalise about the relationship in the population of all such insects, we need to do a hypothesis test.
Part C [11 Questions worth 16 marks in total] A statistics student wanted to see if there is a relationship between the calories and alcohol content of beer. He recorded the calories (per 360ml) and alcohol content (percentage) for the first 85 beers listed on the webpage of a local supermarket. The data is shown in the scatterplot below. The correlation coefficient is also shown below.
1) What does the scatterplot and the correlation coefficient tell us about the relationship between
the calories and alcohol content of beer? [2 marks] There appears to be a positive, strong, linear relationship between the calories and alcohol content
of beer.
4.0 4.5 5.0 5.5 6.0 6.5
10 0
12 0
14 0
16 0
18 0
20 0
Calories versus Alcohol Content of Bee
Alcohol Content (percentage by volume)
C al
or ie
s (p
er 3
60 m
l)
RStudio was used to fit a linear model to the data. Below are the RStudio output, the residual plot and a histogram of the residuals.
2) Write down the linear model equation. [1 mark]
Calories = -26.29 + 34.961 x AlcoholContent
4.0 4.5 5.0 5.5 6.0 6.5
-4 0
0 20
40 60
Residual plot
beer$AlcoholContent
be er
.lm $r
es id
ua ls
Histogram of beer.lm$residu
beer.lm$residuals
Fr eq
ue nc
y
-40 -20 0 20 40 60
0 5
10 15
20
3) What is the intercept and what does it tell us? [2 marks] Intercept = -26.29
This means that for a beer that has no alcohol we would expect that the average calories per 36ml
is -26.3. Calories cannot be negative, so the intercept is not meaningful in this context.
4) What does the slope tell us? [1 mark]
The slope of 34.961 tells us that, on average, calories are expected to increase by 35 calories per
360ml, for each one percent increase in the alcohol content of a beer.
5) One of the beers has 130 calories (per 360ml) and has an alcohol content of 5%. Calculate the
value of the residual for this beer. [2 marks] Expected calories = -26.29 + 34.961 x 5 = 148.515
Residual = 130- 148.515 = -18.515
6) Are the conditions of the linear model met? Explain. [2 marks]
Linearity is met, as the residual plot shows no trend.
Equal spread is met, as the residuals are equally spread above and below the line through zero
on the residual plot.
Normality is not too bad, as the histogram looks to be roughly symmetric.
Independence is questionable since beers were not randomly selected – the sample beers were the first 85 beers on the website so they might have something in common. For example, maybe they are grouped by manufacturer, so only represent a particular subgroup of all the beers available. Or, the list may have been ordered by price, so the sample may only consist of beers of a similar price which may differ in alcohol and calorie content to beers of a different price. So not all conditions are satisfied (unless we assume independence).
7) What is the null hypothesis of the test for the slope? [1 mark]
True slope = 0
8) State the decision for the test for the slope with reason. [1 mark]
Decide in favour of the alternative since the p-value ( <2e-16) is very close to zero ie much smaller
than 0.05.
9) What is the conclusion for this test? [1 mark]
There is evidence of a linear relationship between the number of calories (per 360ml) and the
alcohol content (%by volume) of beer.
10) Are the conditions met for the test for the slope? Explain. [2 marks]
Sampling distribution needs to be normal. This condition is met as the sample size is greater than 30, so the CLT holds. The sample needs to be representative of the population. This may not be satisfied as the student took the first 85 beers on the list.
11) The study above did not take account of the fact that there are different types of beer (e.g.
lager, ale, stout). Explain how this information could be used to improve the sampling method. [1 mark]
Use stratified random sampling by splitting the population up into the different types and then randomly select from within each of these groups.
Part D [6 Questions worth 12 marks in total]
A study was carried out looking for links between diet and development of Alzheimer’s disease. 341 elderly people participated. For six years researchers tracked what these participants ate and drank, and monitored who went on to develop Alzheimer’s. The participants were subsequently divided into two groups based on the amount of tea they drank each day. The group that drank 3 or more cups of tea daily were called Group A. The other group drank less than 3 cups of tea per day were called Group B.
The results are summarised in the plots below:
Graph 1 Graph 2
1) What does Graph 1 tell you? [2 marks] Similar numbers in the two groups get Alzheimers, but the healthy group has a greater number of people in Group A (those who drink 3 or more cups of tea). There are more people altogether in Group A (those who drink 3 or more cups of tea a day).
2) What does Graph 2 tell you? [1 mark] For those people with Alzheimers there is a similar proportion of people in the two groups
A two-sample hypothesis test of proportions was carried out. Below are the hypotheses for this test.
The null: There is no difference between the true proportion with Alzheimer’s in the two groups.
The alternative: There is a difference between the true proportion with Alzheimer’s in the two groups.
The test gave a p-value of 0.001181.
The 95% confidence interval for the difference between proportions (Group B – Group A) has a lower limit of 0.0568 and an upper limit of 0.236.
3) State the decision for the hypothesis test with reason. [2 marks] We decide in favour of the alternative as the p-value is less than 0.05
4) State the conclusion for the hypothesis test. [1 mark]
We have evidence to suggest that there is a difference between the true proportion of people who develop Alzheimer’s for those in the two groups.
5) Explain how the confidence interval adds to this conclusion. [2 marks]
The confidence interval confirms the conclusion of there being a difference between proportion of Alzheimer’s in the two groups because the interval doesn’t include 0. It adds to the conclusion by telling us that there is a greater proportion who get Alzheimer’s in the group who drink less than 3 cups of tea a day. That is, drinking 3 cups or more of tea is associated with a reduced risk of Alzheimer’’s.
6) This study was reported with the headline ‘Drinking tea cuts threat of Alzheimers’. Explain why
this headline is not justified by this study. [2 marks] The headline assumes tea drinking is the cause of reduction in Alzheimer’s. But this is an observational study so it cannot reach conclusions about causation. Tea drinking is related to a reduction in Alzheimer’s but may not be the cause.
7) A statistician commented that the Alzheimer’s study described above could be improved by using an experimental design to control for lurking variables. Describe two potential lurking variables and an experimental design to control for these. [2 marks]
Lurking variables are factors other than tea drinking that affect whether you get Alzheimer’s or not. Possible lurking variables are age, gender, lifestyle, pre-existing conditions…
To control for these, we need to randomly allocate the participants to two groups. One group is told to drink 3 or more cups of tea daily, one group told to drink less.
However, it is problematic to run an experiment like this – people may not follow tea-drinking instructions (but may also not be honest about this!)
+ + + + + + +