This is my final project for the ‘Statistics for Data Scientists’ for the ICS5115 study unit. The final results for this project is best viewed using nbviewer, click on the following link to view results Jupyter Notebook. For a detailed explanation for this project read through the research paper or look at this presentation for an overview.
Resources for this project;
- miscellaneous.R [Various miscellaneous functions and constants]
- data_collection_events.R [Collects Brexit events from AP & Al Jazeera]
- data_collection_finance.R [Collects financial data from Yahoo Finance]
- data_cleansing.R [Cleans the collected datasets]
- Jupyter Notebook/Results [Notebook with visualisations and results]
- Datasets [Both Raw and Cleaned datasets]
- Anaconda Environment
- Research Paper
R version 3.5.1 (2018-07-02) Running under: Ubuntu 18.04.1 LTS IDE: RStudio
The following libraries were used for this implementation. It must be noted that a function in the miscellaneous.R script called ‘lubripack(...)’ script was written to check if the package is already installed and if not the package is installed. So any libraries used are referenced using this function.
- rvest
- quantmod
- stringr
- lubridate
- dplyr
- knitr
- IRdisplay
- kableExtra
- e1071
- broom
- ggplot2
- ggpubr
- repr
Furthermore, an anaconda environment file (environment.yml) is supplied to be able to run the Jupyter Notebook. If you don’t have anaconda installed on your system, follow this tutorial to install anaconda on Ubuntu 18.04. Once anaconda is set up on your system execute the following commands to create an new environment from the supplied yaml file.
conda env create --f environment.yaml # creates a conda environment from file
conda activate r_brexit # activate conda environment
jupyter notebook # run jupyter notebook
The scope of the project is to examine (statistically) whether Brexit events had an impact on the following financial markets: Foreign Exchange Market, Cryptocurrency Market, Stock Market and the commodities market.
- To examine the impact of major brexit events on foreign exchange rates (GBP/EUR, GBP/USD, GBP/JPY).
- To examine the impact of major brexit events on cryptocurrency prices (BTC/GBP, ETH/GBP).
- To examine the impact of major brexit events on stock market prices (FTSE100, FTSE250).
- To examine the impact of major brexit events on commodity prices (GOLD, OIL).
To do so we applied a T-test to examine the following hypothesis:
- Null Hypothesis: There is no significant difference between the abnormal mean returns before a major brexit event and after it (pre-mean = post-mean)
- Alternative Hypothesis: There is a significant difference between the abnormal mean returns before a major brexit event and after it (pre-mean <> post-mean)