MATH10282 Introduction to Statistics
Semester 2, 2018/19
Coursework assignment using R
The deadline for submitting this coursework is 3.00pm on Monday 29 April 2019.
You must submit your work in hard copy form in person in ATB2.223. No email or
late submission will be accepted.
This coursework comprises 10% of the overall marks for the module.
Instructions
(a) You can include code and numerical results from R by copying and pasting into
your document. Comments and discussion of the results should be added as
required. You can save any plots created in R, for example as a PDF, and import
these into your final report. If you wish to include handwritten section (e.g.
with mathematical notation), you may do so by including a scan or photo of the
handwritten part in your report.
Include in your report all R commands used to generate results.
(b) Please include your name and ID in your report. If you have any queries or problems,
please contact me as soon as possible.
(c) Your report should not be longer than 5 printed pages. Longer reports will be
penalised.
The data for this question are contained in https://minerva.it.manchester…
uk/~saralees/data.txt. The data consist of daily closing stock prices of the company
Coca Cola.
(a) Read the data into R. [1]
(b) Compute the log returns of the data. That is, if xt denotes the stock price of day
t compute log xt log xt1. [1]
(c) Draw a histogram of the log returns. Comment about its shape. [1]
(d) Fit a distribution to the log returns data that provides an adequate fit (see part
(f) below). You may use the R package fitdistrplus to fit distributions. [5]
(e) Superimpose the fitted PDF on top of the histogram. Comment on how the two
match. [1]
(f) Does the distribution provide an adequate fit according to the Kolmogorov Smirnov
test (a goodness of fit test). You can perform the Kolmogorov Smirnov test by
using the R command ks.test. If the p-value returned by the command is above
0.05 you may consider the distribution you chose in part (d) as providing an
adequate fit. [1]
[Total 10 marks]
WX:codehelp