ECOM209 module score for completion.
You are required to submit a typed document in Word or PDF format containing written analysis
together with any supporting tables, graphics and R code you think is necessary.
The work required is detailed on the next page. Your code and analyses are required in R.
This coursework has a maximum word count of 1500 words excluding R output and any code
that you submit.
This coursework must be your own work and answers are required in your own words.
Examiner: Dr R.A. Saldanha
Queen Mary University of London, 2023
Page 2 Assessed Midterm Coursework: Semester B ECOM209 (2023)
Semi-Automated Exploratory Data Analysis in R
The datafile equity.csv contains daily prices (Jan 2015 – Dec 2019) on the S&P 500 index
(sp500), Nasdaq 100 index (nasdaq100), a global robotics & automation ETF (robo) and single
stocks abb, fanuc, harmonic, siemens and tesla. Using these data as test inputs, please answer
the following questions. You will need to show code, analyses and suitable written text in your
report. (Parts of the assignment may be carried out in multiple ways.)
1. Load the datafile and create a suitable time series matrix object with the correct date
stamps taken from the first column of the datafile. Yo
u may do this on a standalone basis or
within a more general function.
[8 marks]
2. Research and give a brief description of each of the securities contained in the datafile.
[14 marks]
3. Write a general function that will produce suitable summary statistics, including the mean,
median, standard deviation and range for each of the stocks. (You may choose to also
compute additional statistics not mentioned here.)
[10 marks]
4. Produce suitable graphical summaries for each of the securities.
[10 marks]
5. How do each of the securities compare in terms of the summary statistics you have
generated for 3. and graphical output for 4 (Think carefully about the scale you are using
to compare the securities.)
[15 marks]
6. Define your own specific R class for time series matrices of the type you created in 1.
[10 marks]
7. Work out how to append your new class to the class(es) of the object you created in 1.
[8 marks]
8. Define you own summary and print methods to work with your object class.
[15 marks]
Please turn over
ECOM209 (2023) Page 3
9. Write a plot method that will produce a set of suitable plots for your object class.
Demonstrate that your function works and maintains the time series nature of the object it
operates on.
[10 marks]