Analysing the Effects of Brexit: A Statistical Approach

Analysing the Effects of Brexit: A Statistical ApproachDavid FarrugiaBlockedUnblockFollowFollowingJul 7Illustration by Sky NewsIn my humble opinion, one of the most powerful weapons in a Data Scientist’s arsenal is without a doubt, the ability to apply statistics to a specific use-case to extract meaningful insights about the underlying structure of the respective data.

Through statistical modelling and analysis, a Data Scientist will be able to understand much better the domain being studied; therefore, laying a solid pediment for further machine learning modelling and other analysis.

As a result, given my background, I decided to strengthen my statistical abilities the only effective way I know — practicing with use-cases.

With increasing attention on Brexit, I immediately saw this as an amazing opportunity for a practice application.

Below is a summary of the different processes, techniques, and analysis performed.

First of all, I wanted to start off by scraping the most significant Brexit events, as illustrated below.

The Major Brexit EventsHaving acquired these major dates, we can then proceed to analyse, correlate, and test for potential causation between these Brexit events and other effects.

The plan behind this statistical analysis is as follows: scrape major events, analyse GBP/EUR exchange rate, GBP effective exchange index, UK trading data, UK consumer price indices, and finally, analysing the effects on the cryptocurrency financial market.

The GBP/EUR Exchange RateThe OHLCThe GBP/EUR historic exchange data from 2014/01/01 till 2019/06/19 was pulled from Yahoo Finance, via the quantmod R’s package.

The first step was to group by year to be able to plot the OHLC chart and calculate some descriptive statistic metrics for every individual year.

An OHLC chart is a type of bar chart that shows open, high, low, and closing prices for each period.

OHLC charts are useful since they show the four major data points over a period, with the closing price being considered the most important by many traders.

 — investopediaAdditionally, on top of the OHLC charts, various other statistical charts such as the Bollinger Bands (BB), Moving Average Convergence Divergence (MACD), Rate Of Change (ROC), Stochastic Momentum Index (SMI), Relative Strength Index (RSI), Commodity Channel Index (CCI), and the Stop And Reversal (SAR) were also plotted.

These charts all provide statistical insight into the trends that a specific time-series is following.

Needless to say, these statistical tools are widely adopted in the financial trading and investment domain.

OHLC charts of the GBP/EUR Exchange Rate along with some other statistical charts.

The Causal EffectBesides analysing the OHLC prices, I also wanted to determine whether a specific event had a direct causal effect on the time-series.

After some research, I found this paper published by Google, which perfectly accomplishes what I intended to analyse.

In short, this paper introduces a way of determining the statistical significance of a causal impact by an individual event by constructing a Bayesian structural time-series model.

In turn, this model is then used to predict how the time-series might have looked like provided that the event had never occurred in the first place.

Then, based on a Bayesian one-sided tail-area probability, a p-value is obtained to illustrate the statistical significance of this causal impact.

Causal Impact Result Visualisation taken from the package’s Github page.

Furthermore, the package provided also generates a visualisation (as illustrated in the Figure below) of the results and provides the ability to output the statistical results as a layman-friendly report.

In summary, kudos to everyone involved in this research.

Job extremely well done!The AnalysisBased on the above visualisations, the start of 2016 brought a massive hit to the GBP’s value compared to the EUR, which saw the GBP/EUR exchange starting to decline.

As illustrated by the Bollinger Bands (which depicts volatility), the GBP/EUR exchange was extremely volatile, spiking between the lower and upper bands.

However, around the time of June 2016 (Brexit Vote), the exchange rate suffered a devastating negative impact, which resulted in the constant hitting of the Bollinger lower bands of volatility.

In agreement to this, the MACD also supports the hypothesis of a negative effect on the exchange rate caused by the Brexit vote.

The latter is mainly since the MACD line has fallen under the signal line, as opposed to time points before and after the vote, which seems to be more on par with the signal.

Again, the ROC line also supports and hints to the fact of an adverse effect brought by the Brexit vote.

Just before the start of July 2016, the ROC line depicts a sharp negative spike which strongly signifies a bear investment, meaning money lost on the investment.

Moreover, after constructing the Bayesian model and testing the probability of obtaining such an effect, the p-value obtained was statistically significant; thus, suggesting that the Brexit vote did harm the GBP/EUR exchange value.

Similarly, the SMI also hints at a bearish investment around the time of late June 2016, with the signal continuing to drop down to an ultimate low of -60 (it is commonly understood between investors that an SMI of -40 is a highly bearish trend) in July 2016.

In addition to this, GBP/EUR as an investment seems to have extremely weakened in late June 2016 based on the RSI.

Admittedly, the candle chart, as well as the previously discussed statistical methods, seem to have started stabilising in mid-July 2016, which is around the time when Theresa May was appointed as the Prime Minister of the UK.

Nevertheless, such an event might not be statistically conclusive of having a positive effect on the exchange rate because the exchange rate was still highly volatile throughout the remainder of the year.

This conclusion is also supported by the casual Bayesian inference model, which resulted in a non-significant p-value.

Moving onto 2017, once again the closing prices of the GBP/EUR forex are continually hitting the lower Bollinger Band, resulting in a constant highly volatile down-trending pattern, primarily when consulting the ROC chart.

The first major Brexit event of the year happened on 17 January; consequently, around that time, all charts show a negative spike in the closing value of the exchange rate.

The CCI even reached values of -200, proving evident that at that time, the exchange rate had suffered a firm downtrend.

In addition to this, the SMI line can also be seen to have fallen under the moving average signal line.

Moreover, when plotting the SAR chart on the original time-series, besides confirming the substantial drop in mid-January, it also highlights a closing price increase throughout the rest of the month.

Once again, such movement could be highly correlated with the extremely fluctuating behaviour exhibited by this exchange rate since the p-value obtained from the Bayesian model fails to reject the null hypothesis of statistical significance.

The CCI indicates a bullish-trend (an excellent investment opportunity — indicating a future closing price increase) around late March 2017, which could be associated with the triggering of Article 50 of the Lisbon Treaty, which also resulted in a statistically significant p-value from the causal inference.

Throughout this period, the exchange rate reached the highest values of the year so far.

As represented by the CCI, the next exciting movement in the exchange rate occurs in late May 2017, close to the UK snap general election (8 June).

Additionally, the CCI analysis also potentially hint at a steady decline in early June; however, other methods like the SMI and the RSI did not seem to have been drastically affected on this day.

Thus, an assumption explaining this behaviour could be that investors might have probably acted before the day of the election, resulting in an early effect.

In support of this conclusion, a snap election was called on 18 April 2017, which consequently, was also around the start of the most significant value drop of the year, reaching its lowest point in late August.

Hence, it is highly viable assumption that the effects of the snap general election were mainly observed before the event itself.

In continuation, the p-value obtained from the tail-area probability shows a statistically significant adverse effect on the exchange rate.

The final big event of the year was the Northern Ireland seamless border backstop deal (8 December).

From the end of the year onto 2018, the closing price seemed to be gaining traction once again, which would make sense since the backstop deal would mean that the UK keeps a strong relationship with the EU.

In agreement, after constructing the Bayesian model, the p-value also shows a statistically significant value increase after this event.

Furthermore, 2018 offered quite similar behaviour to the previous years, showing the similar volatility characteristics with market data bouncing back and forth between the Bollinger Bands.

The ROC seems to be quite stable with exceptions of late June (negative spike) and late November (negative spike) which seem to be the outliers.

Coincidentally, during those periods, there were also two major Brexit-related events, which might have triggered the extreme movement.

Nevertheless, the CCI chart does not show significant effects during these periods, and the SMI seems to follow the signal smoothly, however, were found to be significant in influencing a negative effect (both p-values < 0.


Currently, 2019 seems to have provided some stability for the GBP/EUR exchange.

Although it is still quite volatile, the CCI, SMI, and the RSI charts show neutrality in the exchange, especially between February and April, were the values seems to stay relatively between the Bollinger Bands as well.

On the 15th of January and the 12th of March, May lost two necessary votes, which on both occasions, resulted in an uptrend indication by all statistical metrics, which was a statistically significant outcome based on the obtained tail-area probability p-value.

Moreover, the initial end date of Brexit (12 April 2019) resulted in a drop in value, which was later re-balanced by the decision to delay Brexit.

Surprisingly, at first look, the resignation of May does not seem to have altered the behaviour of the exchange since the ROC chart showed virtually no significant rate of change around that time; still, the ROC chart indicates that following that particular event, the price of the exchange could potentially increase (a positive ROC indicating a potential bullish-trend).

Additionally, the p-value obtained using Bayesian modelling suggests a significant adverse effect on the GBP/EUR value.

Nevertheless, as mentioned, the ROC was quite small, and the indication of a positive effect was also not supported by the other metrics.

Analysing the Statistical Significance and Impact (positive or negative) of the Causal Effect on the GBP/EUR per Major Brexit Event.

The GBP/EUR Investment RiskTo effectively determine the best model to construct for risk assessment, we have to first check for normality, independence, and statistical stationarity.

Basic Descriptive Statistics for the GBP/EUR Exchange per year.

First, some analysis on the descriptive statistics composing the time-series was essential to start understanding the underlying structure of this data.

The year 2016 was the year with the highest variance, the most negatively-skewed, had the highest spike in log returns (high kurtosis), and also returned the lowest mean (which was also negative).

The normalised log returns were calculated and plotted as a line chart and also as a histogram to understand the density of the returns better, while also plotting some descriptive statistics, as illustrated below.

Descriptive Statistics Plots for GBP/EUR Closing Log Returns per year.

Furthermore, as shown below, the log return time-series was cleaned by reducing its magnitude and then plotted over the original log return time-series, which helped to give some insight on potential outliers.

Outlier Detection for the Closing Log Returns of the GBP/EURAdditionally, the Quantile-Quantile (Q-Q) plot of the log returns per year was also created.

Clearly, the Q-Q plots show some divergence from normality, suggesting that this time-series does not follow a Gaussian distribution.

To further check for normality, two statistical tests were conducted — Jarque-Bera test (executed on the entire time-series) and the Shapiro-Wilk test (subset per year).

For both of these tests, the null hypothesis represents that the data does come from a normal distribution.

The Jarque-Bera test returned a p-value < 0.

05; thus, rejecting the null hypothesis and confirming the derivations made from the Q-Q plots.

Additionally, running the Shapiro-Wilk test on subsets of the data (per year), returned a p-value < 0.

05 for the years 2014, 2016, 2018, and 2019 which in turn, rejects the null hypothesis of normality.

Moreover, for the other years, the test failed to reject the null hypothesis.

Despite this, given the known nature of stock market data not following a normal distribution, it was assumed that these years also did not follow a normal distribution.

This assumption was also based on the fact that the Jarque-Bera test on the entire dataset returned a significant p-value.

For testing time-series independence, the Ljung-Box test was used.

This test obtained a non-significant p-value; hence, fails to reject the null hypothesis of auto-correlation.

Based on this test, it was then assumed that this time-series did not have any auto-correlations.

Finally, the Augmented Dickey-Fuller test was used to test for stationarity, which returned a significant p-value that rejects the null hypothesis of unit roots.

Based on these statistical tests, an ARIMA model was constructed with AR and MA values of 0.

These values were selected by constructing an Extended Autocorrelation And Cross-Correlation Function (EACF).

The residuals of the ARIMA model were tested using the Lagrange Multiplier (LM) test for ARCH.

The p-value returned by this test was significant; therefore, indicating that there exist ARCH effects in the ARIMA model’s residuals.

Since the null hypothesis of no ARCH effects was rejected, the time-series was then modelled by a GARCH model.

On fitting, the goodness-of-fit of the model was tested using an Adjusted-Pearson test, which resulted in no correlation between the residuals found.

The goodness-of-fit was also tested using a Box-Ljung test which failed to reject the null hypothesis.

Therefore, based on these two outcomes, the model was assumed to be a good fit.

Moreover, as shown in the side figure, the auto-correlation function (ACF) and partial autocorrelation function (PACF), Q-Q plot, and empirical density of the standardised residuals were plotted to summarise the fitted model further.

Using the fitted GARCH model, the log returns volatility was plotted, as depicted below.

Volatility plots of the GBP/EUR exchange based on the GARCH ModelEventually, using the GARCH model and Monte Carlo simulation, the investment risk over the next 20 trading days was calculated, which turned out to be -2.

784% with a 0.

05 level of significance.

Thus, this risk analysis suggests that the GBP/EUR exchange rate is highly volatile and unpredictable, and any investment in this Forex will likely result in a bad one.

The GBP Effective Exchange IndexAs an attempt to effectively model the exchange strength of the GBP, historical data of the GBP Effective Exchange Rate Index was obtained from the UK National Statistics Office as a .

csv file.

The index time-series was then visualised, and markers representing the major Brexit events were added onto the plot.

The power of this plot lies in the ability to support further the causal inference analysis discussed previously, as well as to efficiently be able to map similar exchange behaviour with the EUR to other currencies.

UK Trading DataThe idea behind analysing UK import and export trade data was to be able to understand the actual fluctuations in the GBP strength, and how this might have been affected by external events outside of Brexit.

Similarly to the previous subsection, the principal analysis carried out for this aspect was centred around visualising the flow of import and export data by country.

Through the use of vertical line markers, each representing a specific Brexit event, the effect on the individual country’s values can be estimated.

From the results, there seems to be no correlation between the Brexit events and the respective importing relationships with EU countries.

However, there seems to be an exception to Germany, which seems to produce a rate of change in both imports and exports following major Brexit events.

Admittedly, this feature could be explained by the continually growing materialistic market and population, which would, in turn, result, in more imports and exports.

On the other hand, import/export from/to non-EU countries seem to be highly influenced following Brexit events.

For both imports and exports, volumes seem to spike immediately following a specific event, which suggests direct causation and influence.

This behaviour is especially evident with China, Norway, and the United States.

As a result, based on this analysis, the assumption that Brexit events highly influence the GBP exchange index can be assumed; nevertheless, further hypothesis testing will help accept this observation based on statistical significance.

UK Trading Data filtered by the top EU and non-EU Countries.

UK Consumer Price IndicesThis part of the analysis was done to understand better how the Brexit events have affected the UK quality of life.

Original time-series data for a selected number of CPIs (obtained from the UK National Statistics Office) were plotted and also the inflation percentage was calculated based on this data.

Although all CPIs investigated are suffering from constant rise in inflation, there seem to be no clear signs that these were profoundly affected by the Brexit events.

Nonetheless, it is worth mentioning that from the start of the Brexit dealings (June 2016), the average cost of living for a UK citizen has risen by 6.


Once again, such differences might be accredited to other affairs not investigated as part of this analytical project.

UK Inflation for a number of CPI’s.

Cryptocurrency Financial MarketTop 10 Cryptocurrencies by Market Cap.

As shown by the above figure, the current top 5 cryptocurrencies by market capitalisation are Bitcoin, Ethereum, Ripple (XRP), Litecoin, and Bitcoin Cash.

As a result, the performance of these five cryptocurrencies following some Brexit events was also analysed.

Starting with Bitcoin, Brexit seems to have a positive effect on its value.

Following every significant Brexit event, the price of Bitcoin can be observed to increase.

After modelling the time-series using Bayesian inference, the probability of a causal effect of the snap general election and the backstop deal was 0.

9998 with a tail-area probability of 0.


Thus, based on the constructed Bayesian model, the definite increase in Bitcoin’s value by the Brexit events is statistically significant.

Similarly, Ethereum’s price increase just after the backdrop deal meetings also resulted in being statistically significant.

In the case of Ethereum, at the ‘lost’ marker, a price drop seems to be happening following the event; this potential causal effect was also investigated, which resulted in a non-significant result which could be explained to random fluctuations based on other different events outside Brexit.

The Brexit events also seem not to affect Litecoin’s movement, leaving its flow relatively stable throughout the entire period.

However, it was also noted that a test on the period just after the backdrop meetings resulted in a p-value < 0.

05, rendering a statistically significant positive causal effect of around +150% on Litecoin.

Bitcoin Cash also gained from significant positive effects, showing gains of +100% at times.

Similarly, Ripple also seemed to be positively affected by these Brexit events; however, in the case, gains were of only around 10%.

SummaryIn conclusion, this analysis thoroughly investigated how the Brexit events affected the GBP/EUR Forex index as well as the cryptocurrency financial market.

In addition to this, as part of this analysis, the GBP Effective Exchange Index was also examined to better understand the real strength of the GBP in the entire Forex market.

This analysis allowed for a more comprehensive analysis by allowing a replication degree to what was investigated using the GBP/EUR exchange to other currency exchanges from GBP.

Moreover, this project also considered the aspect of the UK import and export trade data, where the trading volumes by the top countries (both EU and non-EU) were examined, as well as inflation percentages in the UK.

This aspect allowed for more conclusive evidence on the remarks made on the correlation and causation inference between the events of Brexit and the GBP.

This part helped to determine whether the strength gain or loss of the GBP was directly influenced by Brexit or by other external affairs such as lower/higher import/export trades.

Additionally, this analysis also contributed to an additional analytical perspective by providing an initial insight on whether Brexit had any effect on the UK’s import/export trade of goods.

In turn, this project was highly valuable in building a foundation of statistical knowledge and applications to the real-world and acted as a way to truly show the benefits of proper statistical analysis and modelling.

Moreover, even though this analysis faced some limitations such as the inconsideration of other stock markets, especially those within the EU, or failure with justifying significance effect on UK import and export trades statistically, this analysis still managed to reach relatively reliable and conclusive results.

Extending this WorkConsider additional financial markets such as the FTSE 100, S&P 500, and Dow Jones Industrial Average.

Provide deeper statistical analysis on the imports and exports trading data by factoring in the trade data of other countries to contrast the rate of change.

Analysing the effect of Brexit on British companies such as HSBC, Lloyds, and Barclays.

Analysing the effect of Brexit on the UK and also EU unemployment rates.

Further information and the full source code for this project can be further found in this GitHub repository.

If you wish to get in touch — davidfarrugia53@gmail.

comLinkedin — Twitter.. More details

Leave a Reply