Analyzing the Stock Exchange Markets of EU Nations: A Case Study of Brexit Social Media Sentiment

Stock exchange analysis is regarded as a stochastic and demanding real-world setting in which fluctuations in stock prices are influenced by a wide range of aspects and events. In recent years, there has been a great deal of interest in social media-based data analytics for analyzing stock exchange markets. This is due to the fact that the sentiments around major global events like Brexit or COVID-19 significantly affect business decisions and investor perceptions, as well as transactional trading statistics and index values. Hence, in this research, we examined a case study from the Brexit event to assess the influence that feelings on the subject have had on the stock markets of European Union (EU) nations. Brexit has implications for Britain and other countries under the umbrella of the European Union (EU). However, a common point of debate is the EU’s contribution preferences and benefit imbalance. For this reason, the Brexit event and its impact on stock markets for major contributors and countries with minimum donations need to be evaluated accurately. As a result, to achieve accurate analysis of the stock exchanges of different EU nations from two different viewpoints, i.e., the major contributors and countries contributing least, in response to the Brexit event, we suggest an optimal deep learning and machine learning model that incorporates social media sentiment analysis regarding Brexit to perform stock market prediction. More precisely, the machine learning-based models include support vector machines (SVM) and linear regression (LR), while convolutional neural networks (CNNs) are used as a deep learning model. In addition, this method incorporates around 1.82 million tweets regarding the major contributors and countries contributing least to the EU budget. The findings show that sentiment analysis of Brexit events using a deep learning model delivers better results in comparison with machine learning models, in terms of root mean square values (RMSE). The outcomes of stock exchange analysis for the least contributing nations in relation to the Brexit event can aid them in making stock market judgments that will eventually benefit their country and improve their poor economies. Likewise, the results of stock exchange analysis for major contributing nations can assist in lowering the possibility of loss in relation to investments, as well as helping them to make effective decisions.


Introduction
A stock market, also referred to as a stock exchange, is a venue wherein a company's shares or stocks are traded. For each share or stock granted by a publicly traded corporation, a price is associated with this, called a stock price. On any particular day, the total number of shares traded by any corporation is called the stock trading volume. Generally, the data in stock markets are greatly fluctuating and non-linear. These data are collected over time

•
The impact of social media sentiment for a major event, namely Brexit, is evaluated regarding the stock exchange markets of different EU countries. • For efficient data analytics, a deep learning-based method, along with comparative machine learning models, are suggested to perform stock exchange prediction.

•
The proposed sentiment-based algorithm evaluates the effect of the Brexit event on the stock markets for both the greatest and the least contributing EU countries. The rest of the paper is organized as follows: Section 2 explains related work in the field of social media-based stock prediction, Section 3 explains the methodology, and Section 4 presents the results; the discussion is followed by a conclusion and an outline of future research.

Related Work
Stock market prediction is one of the evolving topics of research in academia and real-world businesses. This stock-market forecasting helps researchers to understand better and plan according to business financials. The concept of this research is based on the random walk theory and the efficient market hypothesis (EMH). The researchers evaluated the effects on the current stock market, based on available information, by using the EMH [34,35]. With the help of random walk theory, they have forecasted the stocks' future prices, which have the peculiar habit of constantly changing and a dependency on uncertain news. According to [36], the ability to predict accurately is not more than 50% in such cases. It has been argued that random walk theory does not help in predicting, as forecasting of stock market prices is accurate to some degree [37,38]. Researchers predict that in the case of directional stock forecasting the 56% accuracy is considered substantial [39][40][41][42]. To forecast the stock market, fundamental and technical analysis are two other viewpoints employed, apart from EMH and random walk theory. To predict the stock market with the help of financial conditions, each company's operations, macroeconomic factors, and fundamental analysis are used. The technical analysis is used to study historical prices and the time-series effect. Fluctuations in the stock prices can be analyzed using trends since historical trends repeat themselves. Researchers forecast the stock prices with only the help of historical prices. A Bayesian network was also used for an analysis of the time-series data, using the moving average and autoregressive model and the autoregressive moving average model. Most researchers only used one stock for forecasting [35,36,39] and, to test the instances (transaction dates), they keep the number as low as 14 or 15 [37,43]. This low test-set of instances might not be sufficient for result evaluation.
Moreover, some current research studies and approaches to stock market prediction and analysis involve more sophisticated and advanced algorithms. For instance, a case study of the Chinese stock exchange market is taken into consideration in [44]. In this work, a combined framework of knowledge graphs and deep learning is employed to predict stock prices. It is observed that their suggested method shows the best results in comparison with other methods. Similarly, in [45], a case study of the Tehran exchange is taken into account to examine the impact of daily stock rates by employing a genetic algorithm and multi-layer perceptron. The goal of applying these models in conjunction is to predict one-day returns. In [21], several types of deep learning models, including a multi-layer perceptron (MLP), recurrent neural networks (RNNs), long short-term memory (LSTM), and convolutional neural networks (CNNs) are employed to predict the prices of stocks, utilizing the historical data of companies. This study has employed the data from two stock exchanges, namely, the National Stock Exchange (NSE) and the New York Stock Exchange (NYSE). A special kind of capsule network, namely, a TI-capsule (text and image information-based capsule neural network) is employed by the authors of [46] to predict stock behavior. One of the most dominant features of a TI-capsule is the preservation of features in a vector, and, hence, shows 91% accuracy. It has also been observed that deep learning-based data analytics and artificial intelligence-based decision-making algorithms show better results in stock exchange prediction, and they are extensively adopted methods in this area. Due to their superior performances, they are also employed as a data-analytics approach to industrial big data, such as the planning of smart processes in cognitive automation [47], the comprehension of a cognitive Internet of Things [48], and product decision-making information systems [49]. Furthermore, a relationship among machine learning-based data analytics is considered with regard to stock exchange prediction with data-driven Internet of Things systems and interconnected sensor networks, while there are other research studies where these frameworks have applications such as in smart cities [50].
For instance, a data-driven Internet of Things system, along with machine learning-based assessments, was utilized to determine the COVID-19 pandemic response and recovery rate, for the administration and development of smart sustainable cities [51].
Furthermore, in other applications, such as tourism, the effect of social media influencers (SMIs) is analyzed through statistical data-analytics approaches to decision-making regarding the travel habits of customers [52]. These data analytics systems also have numerous applications in the planning procedures of smart processes in sustainable cyberphysical manufacturing frameworks [53] and the sustainable management of organizational performance [54].

Social Media Sentiment Analysis for Stock Exchange Prediction
Twitter is considered an important social media platform for gathering information and influencing public opinion [55]. It has been shown that social media sentiment analysis plays an integral role in product and restaurant reviews [56,57]. Researchers used information sources to apply sentimental analysis for the improvement of the stock prediction model. Currently, social media is the source from which to gather all the information [58,59]; previously, this information was collected through news forums [55]. Then, the prediction model was used to combine all the sentiments. Linear regression-based frameworks were used for the integration of the textual content with historical prices. Previously, a model was widely used to merge "bags-of-words", which are the text representations used in the prediction model. Schumaker et al. used different textual representation techniques for analysis, such as bag-of-words, name entities, and noun phrases to mine the financial news [39]. Later, they incorporated the information to support vector machine regression and linear regression, acting as the predictive models. The model forecast the stock prices 20 min after the release of the news article. The result showed 57.1% directional accuracy, 0.04261 mean square error, and 2.06% return in a simulated trading engine. From the message boards, messages were also segmented into three classes-hold, sell and buy-using a naive Bayes model. All those messages that fall under these three segments were collectively considered as bullishness, with further analysis of three functions classified as an alternative to bullishness. All this was integrated into the regression model. Their prediction model was not capable of forecasting stock returns effectively. The relationship between the collective indices, such as investors' hopes and fears, was evaluated against stock market indicators on a regular basis [60]. Based on the keywords, the tweets were classified as voicing worry, fear, hope, and so on. According to the authors, a positive relationship of emotional tweets was linked with VIX, and negative relation to the Dow Jones, NASDAQ, and S&P 500. However, they were not using their model to predict stock prices. To evaluate all the stock forecasting, a keyword-based algorithm was created and reported approx. 75% accuracy, on the basis of 14 transactions in mid-September 2012 [43].

Impact of Brexit on Stock Markets
In the existing literature, there are many research studies in which the impact of various social events on the stock markets of different countries is studied. These events include the COVID-19 pandemic [9], the Nigerian presidential election of 2019 [5], and Brexit [23]. In addition, the approaches employed in these studies to study the impact on stock prices vary greatly. For instance, in [9], the impact is studied via a sentiment analysisbased strategy using the Twitter platform. However, specific to the event of Brexit, there do exist some studies in which stock exchange analysis is performed. As an example, in [61], a survey of UK firms is conducted to study the impact of Brexit. This study demonstrates several key findings, such as that Brexit resulted in a significant, widespread, and long-term rise in uncertainty. An empirical study using autoregressive models has been employed by the authors of [24] to study the impact of Brexit on the Indian stock exchange. This study demonstrated that by using the test results of the last four years, it can be observed that Brexit has had a major influence on the Indian stock market. Moreover, the uncertainty in financial markets with regard to Brexit has been studied by the authors of [62]. In this work, both parametric and semi-parametric approaches are employed to analyze whether Brexit has had any major influence on the degree of determination of the FTSE (Financial Times Stock Exchange index). Another empirical analysis has been conducted in [63] to study the influence of Brexit's pre-and post-referendum effects on some chosen stock exchanges. This study concludes that a structural break appeared in every stock index, due to the results of the Brexit referendum. Furthermore, in one study [64], a special case of the New Zealand stock market is analyzed with regard to the Brexit announcement. This impact was analyzed using data from the NZX50 index and details of the closing price of the 50 highest stocks, as well as legitimate stocks available on the Main Board (NZSX). The findings of the study show that the NZX50 index is negatively influenced by Brexit but, on the other hand, NZX50 stock's returns were better during the period of the Brexit referendum. A relational dynamics impact on stock exchanges was studied in [65], regarding pre-and post-Brexit referendum figures. In this work, detrended fluctuation analysis (DFA), along with a detrended cross-correlation coefficient, is employed to study its influence.

Methodology
In the proposed study, we have performed stock exchange forecasting using a sentiment analysis of tweets related to the Brexit event. In the first stage, we acquired the tweets data, followed by the refining and sentiment analysis of the data. Subsequently, we have proposed both linear and non-linear formworks to carry out the stock exchange forecasting. More specifically, linear regression is used as a linear model to determine the value of an independent variable, using a linear combination of dependent variables and their respective coefficients. Support vector regression and convolutional neural networks are used as a non-linear model to estimate the value of stock markets. In addition, several linear and non-linear artificial intelligence-based models, such as support vector analysis and linear regression, are employed as the existing methods for this purpose. However, choosing the best model for stock forecasting is a critical field of study. Deep learning developments have resulted in a full shift toward adopting these models for data analytics [21,46]. Due to their best and most accurate performance being in the domain of data analytics, we have adopted them for our analysis of stock exchanges of EU nations with regard to Brexit sentiment. Furthermore, we have employed the sentiments data from 1,826,290 tweets regarding the stock markets of different EU economies, which is a substantial volume of data; therefore, the deep learning model appears to be a better fit for this analysis as it performs very efficiently when there is a large amount of data. It is crucial to compare the performance of the deep learning model with certain traditional machine learning methods, such as linear regression and support vector regression, in order to assess its ability to handle such large amounts of data since they are widely used for regression problems. We chose linear regression since it is perfectly suited for determining how strong the correlations among variables are.
Furthermore, it is more versatile, easier to interpret, and provides a better comprehension of statistical inference. However, it does not perfectly capture the non-linearity in the dataset, and outliers in the data also affect its accuracy. Similarly, the reason for choosing support vector regression is that it perfectly handles the outliers in the data, along with offering the best generalization ability. However, both these methods do not scale up well for large datasets; hence, we used the deep learning model. In addition, deep learning can work with noisy data and perfectly captures the non-linearity. Moreover, it is observed that the proposed deep learning method outperforms these traditional methods. The proposed methodology is explained in Figure 1 and the details of each subsection are given below.

Dataset Collection
The dataset has been collected for the following countries given in Table 1, from Yahoo! Finance. The starting dates vary for each country but we have used the same end date for each country, according to the availability of a sentiment dataset related to the Brexit event [26]. More precisely, we have collected the data of EU nations that are major contributing countries and those which contribute the least. This selection (i.e., countries of greatest and least contributions) is based on their statistical contribution, in terms of values obtained from a European Commission poll from 2019 [66,67]. The highestcontributing countries to the EU budget include Germany, the UK, France, Netherlands, and Spain, with their stock markets in Frankfurt, London, Paris, Euronext, and Madrid, respectively. Similarly, the lowest-contributing countries to the EU budget include Poland, Hungary, Portugal, and Romania, with their stock markets in Warsaw, Budapest, Euronext Lisbon, and Bucharest, respectively. The dataset incorporates several attributes, such as "open", "close", "high", "low", "volume", and "adj close". More precisely, the "open" attribute provides the opening value of the stock, while the "close" attribute provides the closing prices of stocks on a specific trading day; likewise, the "high" and "low" attributes provide the highest and lowest values of stock traded on that day. In addition, the volume attribute shows the total volume of stock on that particular day, and, after the dividends have been certified, then the remaining stock values are denoted by the "adj close" attribute.

Dataset Collection
The dataset has been collected for the following countries given in Table 1, from Yahoo! Finance. The starting dates vary for each country but we have used the same end date for each country, according to the availability of a sentiment dataset related to the Brexit event [26]. More precisely, we have collected the data of EU nations that are major contributing countries and those which contribute the least. This selection (i.e., countries of greatest and least contributions) is based on their statistical contribution, in terms of values obtained from a European Commission poll from 2019 [66,67]. The highest-contributing countries to the EU budget include Germany, the UK, France, Netherlands, and Spain, with their stock markets in Frankfurt, London, Paris, Euronext, and Madrid, respectively. Similarly, the lowest-contributing countries to the EU budget include Poland, Hungary, Portugal, and Romania, with their stock markets in Warsaw, Budapest, Euronext Lisbon, and Bucharest, respectively. The dataset incorporates several attributes, such as "open", "close", "high", "low", "volume", and "adj close". More precisely, the "open" attribute provides the opening value of the stock, while the "close" attribute provides the closing prices of stocks on a specific trading day; likewise, the "high" and "low" attributes provide the highest and lowest values of stock traded on that day. In addition, the volume attribute shows the total volume of stock on that particular day, and, after the dividends have been certified, then the remaining stock values are denoted by the "adj close" attribute.

Social Media Sentiment Analysis for Brexit
In this proposed study, social media sentiment analysis plays an important role in efficient stock exchange prediction. For this sentiment analysis, Alex Davies' assertion list is used [68] to analyze the effect of sentiment on market development. More specifically, a list of about 5000 words has been used and categorized into positive, negative, and neutral classes. The process that was originally assigned then converted the tweets into tokens. The blank spaces, emojis, and URL links are removed using parsing algorithms. The three sentiment values, i.e., the negative, neutral, and positive classes are used to categorize the tweets. Then, we interchanged our own generated list, consisting of more than 4000 words, with the previous list for sentiment classification. This assists in achieving improved results because it considers the multi-word associations between each word. In this study, we use a different approach for daily sentiment calculation rather than simply considering the probability or just taking the average of the tweet. The results presented in this study are in terms of the percentage value of all three categories of daily tweets. Along these lines, we only considered the positive and negative categories of the tweets and ignored the neutral category of tweets. More precisely, the percentage values of sentiments of a particular day can be computed using Equations (1)- (3): In the above equations, S +ve shows the percentage values of positive sentiments, P s , S −ve shows the percentage values of negative sentiments, N s , U s shows the percentage values of neutral tweets, U s , while T n shows the total tweets on the day or the total number of sentiments recorded on the day.

Linear Regression
Nunno et al. [69] demonstrate that stock market values can be forecasted by using various machine learning-based regression models, such as support vector regression, linear regression, and deep learning models. Among all these, the linear model is utilized most widely because of its strong and simple nature. For this purpose, single and multi-dependent factors are used; therefore, we utilized a multi-linear regression framework [70]. This is a generalized regression algorithm that helps when dealing with various dependent variables.
The β1, β2, . . . , βk values represent the regression co-efficient, with a relationship with x1, x2, . . . , xk, separately, and ε shows the value of random error between the actual and the predicted values.
In addition, βj is the jth coefficient, representing the foreseen alteration in y per unit alteration in the jth independent variable, xj. Let us suppose that e(ε) = 0; then, the βj value can be determined, utilizing Equation (5).

Support Vector Regression
Cortes et al. [71] proposed the use of SVM, which is based on statistical machine learning. The objective behind SVM was to handle structural risks. Since then, many researchers have used a modified SVM for regression problems and employed it for a wide range of applications. These applications include fault prediction, forecasting time-series data, and forecasting power load demand [72].
Let us assume that the data is in the form of a time-series, which is given below in Equation (6): where xi denotes the information given at period i, with components n, and the output data, yi. At that point, the regression can be defined using Equation (7): where w and b represent the weight and bias, respectively. Here, x is the input vector, and this vector can be mapped by the kernel, (xi), into a higher dimensional space. By solving the optimization problems in Equations (8) and (9), we can find out the values of w and b.
This is subject to: Here, C represents the tradeoff between model simplicity and generalizability, whereas the cost is measured using the εi and εi * factors.
Data in non-linear form is plotted from the original vector space to the high dimensional space using kernels, where linear regression can be used. Therefore, the regression models for support vector machines can be obtained as follows, using Equation (10): where αi and αi * represent the Lagrange factor multipliers. In SVM, the most commonly utilized kernel is the RBF kernel, which is also known as the Gaussian radial function. Its width can be calculated using Equation (11): In this research study, open, high, low, volume, sentiment, and adj close values of stock data are considered as input variables, while the output variable is the "close" attribute which is the stock closing price on a specific day of trading.

Convolutional Neural Network
Deep learning models are used to achieve better results in different application areas such as medical imaging [73,74], biometric systems [75], as well as natural language-based tasks [76]. In addition, as compared to linear regression or support vector regression models, they perform better. For this purpose, Convolutional Neural Network (CNN) is used as a deep learning model in this study. The neural network algorithms use a strategy whereby input data is linearly transformed into a new feature space on each hidden layer, then, a non-linear function is applied. This same process will continue until the final layer of CNN, i.e., the output layer. Hence, deep learning models are defined as an information flow from the input layer to the output layer, through hidden layers. Deep learning models are generally defined as a model consisting of a large number of neurons, hidden layers, and hyperparameters that are interconnected and learn through examples. A typical class of utilization for this framework includes the mathematical regression models to approximate and forecast data. The performance of such models is generally improved by using extra information during the training phase. We have utilized the default settings for deep learning-based CNNs for this reason.
In our proposed framework, at the first layer of the network, the input data contains seven column values, namely, open, high, low, volume, sentiment, and adj close. The output acquired from the CNN framework approach is evaluated using the mean absolute error and root mean square error. In this research, the "close" value is predicted using the remaining attributes mentioned above. All these seven parameters are already available in the datasets utilized for stock trade forecasts, and sentiment value regarding the Brexit event is taken from Twitter information. The architecture is explained in Figure 2.
Systems 2022, 10, x FOR PEER REVIEW 10 of 25 models are generally defined as a model consisting of a large number of neurons, hidden layers, and hyperparameters that are interconnected and learn through examples. A typical class of utilization for this framework includes the mathematical regression models to approximate and forecast data. The performance of such models is generally improved by using extra information during the training phase. We have utilized the default settings for deep learning-based CNNs for this reason. In our proposed framework, at the first layer of the network, the input data contains seven column values, namely, open, high, low, volume, sentiment, and adj close. The output acquired from the CNN framework approach is evaluated using the mean absolute error and root mean square error. In this research, the "close" value is predicted using the remaining attributes mentioned above. All these seven parameters are already available in the datasets utilized for stock trade forecasts, and sentiment value regarding the Brexit event is taken from Twitter information. The architecture is explained in Figure 2.

Results and Discussion
This section presents the results of a stock exchange prediction, without applying sentiment analysis for the impact of Brexit, and considering sentiment regarding Brexit for all countries. The results are divided into four parts; the first two parts present and explain results for both the top and lowest contributing EU countries, without using Brexit variables, and the second and last section gives the findings of the sentiment analysis, incorporating the Brexit event. The evaluation metrics used for both of these experiments are the mean absolute error (MAE) and root mean squared error (RMSE) [54,55,75,76].

Stock Exchange Prediction without Incorporating Sentiment Analysis of the Brexit Event with Major Contributing Countries
In our first experiment, we have used three different algorithms for stock exchange prediction. The algorithms are linear regression, support vector regression, and deep learning. These algorithms were applied to the stock exchange dataset obtained for different European Union countries. These countries are divided into two parts. The first part includes countries that are the major contributors to the EU budget, and we have considered Germany, the UK, France, the Netherlands, and Spain to comprise this set. This selection is based on their contribution in terms of statistical values collected from a survey of the European commission in 2019 [66]. More precisely, we chose two countries with very high statistical values and some countries making lower contributions that still fall under the umbrella of high, i.e., on two different scales, very high and high.
In the first experiment, we collected a huge dataset for these countries and projected stock exchange prices, without taking into account any social media sentiment analysis of the Brexit event. As discussed in Section 3, that dataset was collected from Yahoo! Finance for each of the country's stock exchanges, according to the dates given in Table 1. Later,

Results and Discussion
This section presents the results of a stock exchange prediction, without applying sentiment analysis for the impact of Brexit, and considering sentiment regarding Brexit for all countries. The results are divided into four parts; the first two parts present and explain results for both the top and lowest contributing EU countries, without using Brexit variables, and the second and last section gives the findings of the sentiment analysis, incorporating the Brexit event. The evaluation metrics used for both of these experiments are the mean absolute error (MAE) and root mean squared error (RMSE) [54,55,75,76].

Stock Exchange Prediction without Incorporating Sentiment Analysis of the Brexit Event with Major Contributing Countries
In our first experiment, we have used three different algorithms for stock exchange prediction. The algorithms are linear regression, support vector regression, and deep learning. These algorithms were applied to the stock exchange dataset obtained for different European Union countries. These countries are divided into two parts. The first part includes countries that are the major contributors to the EU budget, and we have considered Germany, the UK, France, the Netherlands, and Spain to comprise this set. This selection is based on their contribution in terms of statistical values collected from a survey of the European commission in 2019 [66]. More precisely, we chose two countries with very high statistical values and some countries making lower contributions that still fall under the umbrella of high, i.e., on two different scales, very high and high.
In the first experiment, we collected a huge dataset for these countries and projected stock exchange prices, without taking into account any social media sentiment analysis of the Brexit event. As discussed in Section 3, that dataset was collected from Yahoo! Finance for each of the country's stock exchanges, according to the dates given in Table 1. Later, this dataset was divided into training and test sets followed by applying the algorithms to forecast the stock prices. The results are presented in Table 2 for the above-mentioned five countries. More precisely, Table 2 is divided into two parts. The first part provides the mean absolute error (MAE) of all three algorithms for stock exchange prediction results. Similarly, the second part provides the root mean squared error (RMSE) values of all algorithms for each country. It is clear from Table 2 that the prediction error for all countries is higher using linear regression and support vector regression compared to deep learning in most cases. The highest error observed among these major contributors is for the UK and Spain. However, the least errors observed among these countries were Germany, France, and the Netherlands. The best mean absolute error for Germany, the UK, France, Netherlands, and Spain are 0.403, 4.586, 0.140, 0.824, and 10.580, respectively. The values show that there is a certain fluctuation from the Brexit point of view, and this is most noticeable for the UK and Spain. The results are also presented in graphical form in Figure 3 for Germany, the UK, France, the Netherlands, and Spain. It is obvious from the corresponding graphs that there are certain fluctuations in the stock market for each country. These results are predicted especially when the Brexit discussion was at its peak, back in 2016. Investors usually consider such events before making investment decisions. However, the error rate is higher for stock exchange prediction using linear regression and support vector regression, while deep learning produced better results overall among these techniques. this dataset was divided into training and test sets followed by applying the algorithms to forecast the stock prices. The results are presented in Table 2 for the above-mentioned five countries. More precisely, Table 2 is divided into two parts. The first part provides the mean absolute error (MAE) of all three algorithms for stock exchange prediction results. Similarly, the second part provides the root mean squared error (RMSE) values of all algorithms for each country. It is clear from Table 2 that the prediction error for all countries is higher using linear regression and support vector regression compared to deep learning in most cases. The highest error observed among these major contributors is for the UK and Spain. However, the least errors observed among these countries were Germany, France, and the Netherlands. The best mean absolute error for Germany, the UK, France, Netherlands, and Spain are 0.403, 4.586, 0.140, 0.824, and 10.580, respectively. The values show that there is a certain fluctuation from the Brexit point of view, and this is most noticeable for the UK and Spain. The results are also presented in graphical form in Figure 3 for Germany, the UK, France, the Netherlands, and Spain. It is obvious from the corresponding graphs that there are certain fluctuations in the stock market for each country. These results are predicted especially when the Brexit discussion was at its peak, back in 2016. Investors usually consider such events before making investment decisions. However, the error rate is higher for stock exchange prediction using linear regression and support vector regression, while deep learning produced better results overall among these techniques.

Stock Exchange Prediction without Sentiment Analysis of the Brexit Event, with Lowest-Contributing Countries
In our second experiment, the same three algorithms were used to predict the stock exchange values for the group of countries making the smallest contributions to the EU budget. The dataset is collected in the same manner as in the first experiment. Later, the collected data is divided into two non-overlapping sets of training and tests. More precisely, in this experiment, the dataset includes the data from the countries contributing least i.e., Portugal, Poland, Romania, and Hungary. This selection is founded on their statistical contribution, in terms of the values obtained from a European Commission study in 2019 [66,67]. For low-contributing countries, we chose countries having a statistical value of 1 or greater. All three algorithms, in this case, linear regression, support vector regression, and convolutional neural networks are applied. The results of these algorithms in terms of MAE and RMSE are given in Table 3. The first part of Table 3 provides the values of MAE for each of the lowest-contributing countries, using all three algorithms.

Stock Exchange Prediction without Sentiment Analysis of the Brexit Event, with Lowest-Contributing Countries
In our second experiment, the same three algorithms were used to predict the stock exchange values for the group of countries making the smallest contributions to the EU budget. The dataset is collected in the same manner as in the first experiment. Later, the collected data is divided into two non-overlapping sets of training and tests. More precisely, in this experiment, the dataset includes the data from the countries contributing least i.e., Portugal, Poland, Romania, and Hungary. This selection is founded on their statistical contribution, in terms of the values obtained from a European Commission study in 2019 [66,67]. For low-contributing countries, we chose countries having a statistical value of 1 or greater. All three algorithms, in this case, linear regression, support vector regression, and convolutional neural networks are applied. The results of these algorithms in terms of MAE and RMSE are given in Table 3. The first part of Table 3 provides the values of MAE for each of the lowest-contributing countries, using all three algorithms. Similarly, the second part of Table 3 lists the RMSE values of all three algorithms. It can be seen that the results are extremely interesting; these are weak economies and their corresponding stock exchanges are also not very strong. Portugal and Romania have relatively better stock exchanges among the group of countries mentioned in this set. The variations in all these countries are also evident from the results, but these variations are less significant compared to the major contributing economies considered in this study. In this scenario, the results for all three algorithms are good, but deep learning presents even better results in terms of MAE. The best results achieved are 0.140, 0.000, 0.012, and 0.001 for Portugal, Poland, Romania, and Hungary, respectively, as can be seen in Table 3. The results are also presented in graphical form in Figure 4 for the countries contributing least. The related graphs show that there are specific variations in the stock market for each country. These outcomes were notably foreseen when the Brexit debate was at its climax in 2016. In these circumstances, the influence appears to be minimal, maybe because they are not well-established economies. However, the error rate for linear regression and support vector regression is also very good, but deep learning produced better results overall among these techniques.  Similarly, the second part of Table 3 lists the RMSE values of all three algorithms. It can be seen that the results are extremely interesting; these are weak economies and their corresponding stock exchanges are also not very strong. Portugal and Romania have relatively better stock exchanges among the group of countries mentioned in this set. The variations in all these countries are also evident from the results, but these variations are less significant compared to the major contributing economies considered in this study. In this scenario, the results for all three algorithms are good, but deep learning presents even better results in terms of MAE. The best results achieved are 0.140, 0.000, 0.012, and 0.001 for Portugal, Poland, Romania, and Hungary, respectively, as can be seen in Table  3. The results are also presented in graphical form in Figure 4 for the countries contributing least. The related graphs show that there are specific variations in the stock market for each country. These outcomes were notably foreseen when the Brexit debate was at its climax in 2016. In these circumstances, the influence appears to be minimal, maybe because they are not well-established economies. However, the error rate for linear regression and support vector regression is also very good, but deep learning produced better results overall among these techniques.

Stock Exchange Prediction with Sentiment Analysis of Brexit Event, with Major Contributing Countries
In our third experiment, the same three different algorithms for stock exchange prediction were used. However, in this experiment, we have also considered the sentiments regarding the Brexit event in the dataset, to evaluate all of the algorithms. More explicitly, these algorithms were applied to the stock exchange dataset obtained from different European Union countries like Germany, the UK, France, the Netherlands, and Spain. A large dataset was collected for these countries. We predicted the stock exchange values using sentiment analysis regarding the Brexit event, from 24 February 2016 to 3 May 2016, consisting of 1,826,290 tweets. In this particular experiment, we have employed the data regarding major contributing countries, as listed in Table 1. After the collection of data, the whole dataset is divided into training and test sets. The training set is employed to train the algorithm and, later, the results are analyzed with the test set. Table  4 shows the results of this experiment. Similar to the previous two experiments, the results of this experiment are also validated in terms of MAE and RMSE. The first part of Table 4 provides the values for MAE, while the second part provides the RMSE values. It is clear that the prediction results have been improved using a sentiment analysis of Brexit events, especially within the small window available for the dataset. The training dataset before Brexit is huge and we have not used any other event. The algorithms were intended to adapt and learn quickly, to provide better results in these scenarios, and they performed satisfactorily except in the case of Spain. The error for all countries is higher using linear regression and support vector regression compared to deep learning in most of the cases.

Stock Exchange Prediction with Sentiment Analysis of Brexit Event, with Major Contributing Countries
In our third experiment, the same three different algorithms for stock exchange prediction were used. However, in this experiment, we have also considered the sentiments regarding the Brexit event in the dataset, to evaluate all of the algorithms. More explicitly, these algorithms were applied to the stock exchange dataset obtained from different European Union countries like Germany, the UK, France, the Netherlands, and Spain. A large dataset was collected for these countries. We predicted the stock exchange values using sentiment analysis regarding the Brexit event, from 24 February 2016 to 3 May 2016, consisting of 1,826,290 tweets. In this particular experiment, we have employed the data regarding major contributing countries, as listed in Table 1. After the collection of data, the whole dataset is divided into training and test sets. The training set is employed to train the algorithm and, later, the results are analyzed with the test set. Table 4 shows the results of this experiment. Similar to the previous two experiments, the results of this experiment are also validated in terms of MAE and RMSE. The first part of Table 4 provides the values for MAE, while the second part provides the RMSE values. It is clear that the prediction results have been improved using a sentiment analysis of Brexit events, especially within the small window available for the dataset. The training dataset before Brexit is huge and we have not used any other event. The algorithms were intended to adapt and learn quickly, to provide better results in these scenarios, and they performed satisfactorily except in the case of Spain. The error for all countries is higher using linear regression and support vector regression compared to deep learning in most of the cases. The highest error observed among these major contributors is still found in the case of the UK and Spain. However, the least errors observed among these countries were for Germany, France, and the Netherlands. The best mean absolute errors for Germany, the UK, France, Netherlands, and Spain are 0.330, 4.197, 0.148, 0.417, and 12.144, respectively. The values show that there is a certain fluctuation from the Brexit point of view; mostly, it can be seen in the UK and Spain. The results are also presented in graphical form in Figure 5 for Germany, the UK, France, the Netherlands, and Spain. It is obvious from the corresponding graphs that there are certain fluctuations in the stock market for each country. These results are particularly clearly predicted using the sentiment dataset of the Brexit event, which was available for 68 days, during which Brexit discussions were at their peak back in 2016. Such information can be useful for intelligent decision-making. The results have been improved using the sentiment analysis of the Brexit event, and deep learning performed better than linear regression and support vector regression. 18.582 The highest error observed among these major contributors is still found in the case of the UK and Spain. However, the least errors observed among these countries were for Germany, France, and the Netherlands. The best mean absolute errors for Germany, the UK, France, Netherlands, and Spain are 0.330, 4.197, 0.148, 0.417, and 12.144, respectively. The values show that there is a certain fluctuation from the Brexit point of view; mostly, it can be seen in the UK and Spain. The results are also presented in graphical form in Figure 5 for Germany, the UK, France, the Netherlands, and Spain. It is obvious from the corresponding graphs that there are certain fluctuations in the stock market for each country. These results are particularly clearly predicted using the sentiment dataset of the Brexit event, which was available for 68 days, during which Brexit discussions were at their peak back in 2016. Such information can be useful for intelligent decision-making. The results have been improved using the sentiment analysis of the Brexit event, and deep learning performed better than linear regression and support vector regression.

Stock Exchange Prediction with Sentiment Analysis of the Brexit Event, with countries contributing least
In our last experiment, the same three algorithms were used to predict the stock exchange values for the group of countries making the least contributions to the EU budget. These countries include Portugal, Poland, Romania, and Hungary. Similar to the third experiment, we have also used sentiment information related to the Brexit event for stock prediction. The same patterns of results are visible here; these are weak economies and their corresponding stock exchanges are also not very strong, except in the case of Portugal and Romania, found among this group. The variations in all these countries are also evident from the results but these variations are less compared to those of the major contributing economies considered in this study. In this scenario, the results for all three algorithms are good, but deep learning offers even better results in terms of MAE, except in the case of Romania. The best results achieved are 0.138, 0.000, 3.177, and 0.001 for Portugal, Poland, Romania, and Hungary, respectively, as shown in Table 5. The results are also presented in graphical form in Figure 6 for Portugal, Poland, Romania, and Hungary. These results are predicted using the sentiment dataset of the Brexit event in this research. Back in 2016, the Brexit debate was at an all-time high. The results have improved using sentiment analysis of the Brexit event; deep learning performed better than both linear regression and support vector regression. It can be concluded that the effect of Brexit is more clearly visible for countries contributing greatly to the EU budget as there is an assumption that these countries might have to compensate for the disappearance of the UK share in monetary terms. On the other hand, for the UK, it is obvious from the stock exchange predictions and fluctuations that investors are, as yet, indecisive about the future. Therefore, the fluctuations that happened to most of the large contributing economies can be related to sentiments regarding the Brexit event.

Stock Exchange Prediction with Sentiment Analysis of the Brexit Event, with Countries Contributing Least
In our last experiment, the same three algorithms were used to predict the stock exchange values for the group of countries making the least contributions to the EU budget. These countries include Portugal, Poland, Romania, and Hungary. Similar to the third experiment, we have also used sentiment information related to the Brexit event for stock prediction. The same patterns of results are visible here; these are weak economies and their corresponding stock exchanges are also not very strong, except in the case of Portugal and Romania, found among this group. The variations in all these countries are also evident from the results but these variations are less compared to those of the major contributing economies considered in this study. In this scenario, the results for all three algorithms are good, but deep learning offers even better results in terms of MAE, except in the case of Romania. The best results achieved are 0.138, 0.000, 3.177, and 0.001 for Portugal, Poland, Romania, and Hungary, respectively, as shown in Table 5. The results are also presented in graphical form in Figure 6 for Portugal, Poland, Romania, and Hungary. These results are predicted using the sentiment dataset of the Brexit event in this research. Back in 2016, the Brexit debate was at an all-time high. The results have improved using sentiment analysis of the Brexit event; deep learning performed better than both linear regression and support vector regression. It can be concluded that the effect of Brexit is more clearly visible for countries contributing greatly to the EU budget as there is an assumption that these countries might have to compensate for the disappearance of the UK share in monetary terms. On the other hand, for the UK, it is obvious from the stock exchange predictions and fluctuations that investors are, as yet, indecisive about the future. Therefore, the fluctuations that happened to most of the large contributing economies can be related to sentiments regarding the Brexit event. Hungary 0.004 ± 0.007 0.000 ± 0.000 0.001 ± 0.001 0.008 0.000 0.001 Figure 6. The stock prediction results for countries contributing least, with sentiment analysis of the Brexit event in graphical form.
Britain has already endured the consequences of Brexit, as its currency reaches an almost 30-year-low value. It has also been reported that a few major firms indicated that the decline in the currency would increase their costs. Many businesses are moving their headquarters to the EU, which has slowed down the UK economy. As far as the public sector is concerned, the EU contribution can be utilized for other projects by the government. Britain had an important position in the EU; around 14.8% of the economic area of the EU consisted of the UK, with a population of around 12.5%. The most debated discussion in Britain is about the future of British trade with the EU after Brexit. The EU's trade deficit, which Britain runs, prompts the question of whether the EU needs Britain more than Britain needs the EU.

Discussions
Contribution to the Literature Social media data analytics is one of the emerging topics in research since individual opinions and sentiments play a vital role in different events and aspects, such as companies, products, or any current issue [4][5][6]. Furthermore, this social media data analysis also assists in determining trends in the stock markets. Advanced models, like Britain has already endured the consequences of Brexit, as its currency reaches an almost 30-year-low value. It has also been reported that a few major firms indicated that the decline in the currency would increase their costs. Many businesses are moving their headquarters to the EU, which has slowed down the UK economy. As far as the public sector is concerned, the EU contribution can be utilized for other projects by the government. Britain had an important position in the EU; around 14.8% of the economic area of the EU consisted of the UK, with a population of around 12.5%. The most debated discussion in Britain is about the future of British trade with the EU after Brexit. The EU's trade deficit, which Britain runs, prompts the question of whether the EU needs Britain more than Britain needs the EU.

Discussion
Contribution to the Literature Social media data analytics is one of the emerging topics in research since individual opinions and sentiments play a vital role in different events and aspects, such as companies, products, or any current issue [4][5][6]. Furthermore, this social media data analysis also assists in determining trends in the stock markets. Advanced models, like artificial neural networks and traditional intelligence-based models, have been used to perform this data analysis [19,35,36,39]. In the last few years, the tendency to use artificial intelligence-based stock forecasting models, specifically deep learning models, has increased [21,46]. However, there are also some other traditional artificial intelligence-based models, like support vector and linear regression analyses, which are used for this purpose [77,78]. Still, finding the most suitable model for stock forecasting is a vital area of research. With the current advancements in deep learning, there has been a complete shift toward using these models for data analytics. The results of deep learning-based models are exceptional for classification and prediction purposes [73,74]. From this perceptive, the current work has employed a deep learning model, namely, a convolutional neural network (CNN), to carry out social media sentiment analysis with regard to the Brexit event, to assess its impact on stock exchange markets. More precisely, we have performed a detailed analysis of stock exchanges of different EU nations, with regard to Brexit event sentiment. For comparison, we have also proposed machine learning-based data analytics models, namely, linear regression and support vector regression. It is clear from the analysis of the results that a convolutional neural network shows better results in comparison with the other two methods. One possible reason for the improved results with deep learning is the volume of data we used. We have employed sentiments from about 1,826,290 tweets regarding Brexit, which is a substantially large number that, hence, become an important factor in improving the performance of deep learning algorithms since they are data-hungry and perform better if a large amount of data is employed. In addition, we have validated all the models and reported our findings with two different experimental settings. In the first experimental setting, we performed a stock exchange prediction of both major contributors and least contributing nations without taking Brexit into account; later, in the second experimental setup, we performed the stock exchange prediction including sentiments regarding Brexit for both major contributors and countries contributing least. The results are presented in terms of MAE and RMSE for all three algorithms in each of the experiments.
Further, if an in-depth analysis of results is performed, then it becomes clear that the results of stock exchange predictions are greatly dependent on the incorporation of sentiments related to mega-events. However, in this study, the mega-event that is under consideration is Brexit. The deep learning-based frameworks provide efficient stock exchange prediction, especially when the sentiment analysis of a larger set of tweets is conducted utilizing Twitter, a social media platform, as a feature. This is owing to the fact that deep learning models are data-hungry, and, as more data is utilized, their performance improves. In a previous study, a linear model was used that showed a weak correlation between stock forecasting and the sentiments of investors [79]. The authors reported strong results that showed the substantial link between fluctuations in stock prices and the sentiments of the investors. They used only 3 hashtags in 60,000 tweets from the UK local election of 2016. The future return on volatile stocks, medium stocks, non-profitable stocks, small stocks, dividend-paying stocks, and non-dividend-paying stocks is considerably lower when the sentiments of the investors are high, and vice versa. Similarly, Economou et al. [80] also predicted stock returns through the use of social media tweets. They projected that social media tweets will have a significant impact on stock price fluctuations. Stock forecasting is also impacted by the volume of tweets. According to Chiang et al. [60], different expressions of sentiments on Twitter give the complete "set of predictors", which in turn help to minimize the margin of error while analyzing the stock fluctuations. Investors have stochastic beliefs that cause sentiments of over-pessimism or optimism, which deviate the stock prices from their actual value. According to researchers, the correction of deviated stock prices is possible, once the economic fundamentals are revealed and the investors' sentiments fade [68,81]. As a result of this correction of stock prices, future stock returns and the sentiments of investors are linked inversely.
In addition, investors' sentiments become an important factor in forecasting stock returns fluctuations. Our results are in line with the statement that mega-events such as Brexit, COVID-19, or any other event related to current issues and the sentiments of investors play an important role in forecasting stock returns. Previously, it was argued that the investors' sentiments are enough to predict small stock returns but recently, the shreds of evidence showed that stocks' characteristics, like firm size, age, and volatility, depended on the predictive pattern of investor sentiments [82]. Most of the research has been conducted over a short period, just to forecast stock returns with the help of social media sentiments and in terms of domestic or international political events. However, our study contributes to the already existing knowledge base of a major event, namely, Brexit, to analyze sentiments and stock return fluctuation in the EU's stock markets. Apart from this, we have used 1.82 million tweets, which is a sufficiently large dataset. This shows that our study presents intensive information supporting the importance of stock forecasting and sentiment analysis. Furthermore, in previous studies [22,60,62], the impact of the Brexit event is analyzed using different statistical approaches, as shown in Table 6. Moreover, from Table 6, it is also clear that in the existing studies, the analysis is performed for specific countries and states. However, in this study, a large group of EU nations, viewed from two different perspectives, i.e., major contributors and countries contributing least, have been considered to analyze the impact of the Brexit event on their stock exchanges. We have elicited and examined the results of stock exchange predictions with two different experimental scenarios. In the first scenario, we examined the impact without considering Brexit sentiment; however, in the second scenario, we have taken Brexit-related sentiment into account and conducted stock-exchange prediction. It can be observed that the prediction results have been improved by involving sentiment analysis of the Brexit event. In addition, this study has employed the most sophisticated and accurate approach, which is convolutional neural networks, along with two machine learning-based models used instead of statistical tools and methodologies to study the impact. It is reasonable to conclude that the proposed study presents a more in-depth and comprehensive analysis of stock exchanges with regard to a case study of Brexit social media sentiment. More specifically, all the empirical results are thoroughly illustrated by the specified list of contributions in the first section. Furthermore, Table 7 shows the comparison with existing studies, in terms of forecasting stock prices, wherein different methods are employed. It is clear from Table 7 that different research studies have employed several methods, including convolutional neural networks (CNNs) and machine learning models, such as SVR. Table 6. Comparison with existing studies, with regard to Brexit event-based stock exchange analysis. Furthermore, a neuro-fuzzy, two-stage ensemble approach and ARIMA models with parameter tuning, using evolutionary algorithms, are also exploited. These studies have performed a stock market prediction on the stock markets of different countries, as shown in column 4 of Table 7. It is evident from Table 7 that the method proposed in this study is optimal in comparison with existing studies.

Implications for Practice
It has been shown that recent researchers are keen to figure out the relationship and effect of public opinion exchange, on different social media platforms, on stock market fluctuations with regard to different political and social events [22,60,62]. This research used intensive data of a large event, namely, Brexit, to analyze investor sentiments through their declared mood on social media, as a means to calculate whether or not they bear any relation. The results highlight that the stock price fluctuation is related to Brexit and that it has played a role in the stock forecasting of different EU countries. Hence, this study offers numerous guidelines for policymakers, managers, and investors as it depicts the ways in which the investors' sentiments can become a predictive force for stock forecasting; therefore, investors should be vigilant while investing in stocks that are more vulnerable to domestic and global events, e.g., COVID-19 or Brexit, etc. Market inefficiency is caused by these sentiments, followed by rumors that can seriously damage the investors' portfolios. This irregularity happens in the market because investors mimic each other's trade habits, based on such sentiments, causing volatility in the market. Therefore, there should be proper systems in place to educate investors, to avoid such consequences being triggered by sentiment. To this end, we have analyzed a large event in a particular set of countries. The results showed that Brexit affected most of the stock exchanges in EU countries. Hence, individual investors must be very vigilant regarding the sentiment surrounding megaevents, such as Brexit in this case, especially while making financial decisions.
Furthermore, the strength of this study includes the fact that it also helps in guiding policymakers and managers, especially in keeping the stocks' sensitivity in mind when it comes to the responses of investors to Brexit. More precisely, it helps them to decide about stock selling and buying while keeping an eye on market trends regarding Brexit. This might not necessarily be about Brexit; there may be other events where sentiments are employed not only from Twitter but also from other platforms to examine their impact on future stock prices. One of the most daunting challenges for investors is to find an ideal moment to either purchase or sell the stocks since there are many essential factors that affect stock prices and the investors' decisions. The perception of investors is increased, related to the influence of Brexit sentiments on the stock exchanges of EU nations, and this ultimately generates the appropriate responses. If investors can foresee how stock prices would behave in certain situations, they can move swiftly and will benefit more. To prevent any instability in the stock market, caused by social media sentiments, there is a need to design policies, safety nets, and circuit breakers to avoid such situations. There must be a system that helps individual investors to deal with the rumors that spread on social media regarding volatile macroeconomic parameters; this will also help them to avoid ending up in noise trading by surviving uncertain situations. As the findings of our study show, policymakers should keep an eye on such sensitive markets concerning the Brexit event.
Furthermore, by analyzing our results from two different perspectives, i.e., the lowest contributing and major contributing countries, the results of this stock analysis indicate that by taking into account the sentiments of the Brexit event, the stock analysis becomes more meaningful and accurate, since these major events have a significant impact. It is also worth noting the impact of this research on two distinct groups of nations. As stated in the introductory section, the United Kingdom was formerly one of the most powerful and well-established members of the EU, paying significantly into the EU budget. As Brexit continues, the remaining nations paying into the EU budget, some of which have poor economies and some of which have strong economies, will see a significant financial effect as a result of the UK's decision, in terms of investments. For example, the lowest contributing nations, which do not generally have a good economy and have a poorer financial standing, must contribute more to the budget to compensate for the impact of Brexit. Furthermore, as a result of this occurrence, the countries contributing least will be incurring expenditures since the EU budget is reduced, i.e., less support is available to them owing to a lack of funds in the budget. Similarly, on the one hand, the major contributing countries that contribute the most are under pressure to contribute more in order to offset the financial impact of Brexit. Hence, the results on stock exchange markets with regard to Brexit event sentiment play a huge role in forward planning and making the best business decisions. On the other hand, this stock analysis aids the major contributing nations in determining how to effectively compensate for the shortfall in the EU budget as a result of Brexit without bearing the excessive load of contribution, effectively take optimal decisions regarding stocks, and continue to propagate the primary objective of the EU.
The limitations of the current study include the possibility that the news or opinions of the people related to Brexit on social media platforms, such as Twitter, might be fake but, ultimately, they can affect stock market trends and results. More specifically, if certain individuals, for example, post fake tweets or news about a certain event, such as Brexit, from either a positive or negative perspective, then the actual sentiments of such individuals are disguised, and the consequences are dire as a result. For example, if there are 100 people, and 80 of them post fake news (e.g., intentionally fake tweets) about the Brexit event, and we predict stock prices based on the sentiment voiced in these fake tweets, we will end up with incorrect results and investors or business decision-makers will make poor investment decisions, based on this misleading analysis. This situation might be improved and remedied by adding one extra module by which fake tweets are removed before considering their impact on stock exchanges. One another limitation is that stock data have sequential characteristics and, to better describe such data, the advanced set of deep learning algorithms, namely, recurrent neural networks and long short-term memory (LSTM) analysis works better than the simple CNN employed in this study. Moreover, the proposed framework can be extended to evaluate the impact of any other major events on stock markets.

Conclusions and Future Work
Stock exchange forecasting is one of the most challenging subjects in financial markets. Currently, stock exchange forecasting using social media sentiment analysis for major social and political events is an important research area. This is because emotion and the sentiment expressed by the public influence the stock exchanges and the buying patterns of investors, as well as business decisions. In addition, the analysis of sentiments on social media platforms regarding specific events leads to providing more information, since they have significant consequences for stock exchanges. There are many such events whose impact on stock exchanges was studied in the past; however, in this particular analysis, an important event, namely, Brexit is considered as a case study. More specifically, as a primary goal of this research, we used the case study of the Brexit event to analyze the influence of its sentiment on stock markets. We have proposed an efficient deep learning approach, namely, a convolutional neural network, to accomplish this analysis. In addition to that, we also proposed machine learning frameworks, i.e., linear regression and support vector regression. For sentiments, we used the Twitter dataset of Brexit tweets to check the effect of sentiments regarding Brexit events, in terms of the major contributors and lowest contributing EU countries. In comparison with existing methods, overall, we processed more than 1.8 million tweets and extracted the sentiments related to Brexit, which data were then used for stock exchange prediction. The results are presented, both without and with sentiment analysis. The results show that sentiment analysis of Brexit improves stock exchange prediction, especially for major contributing countries. Furthermore, the major contributing nations contribute more to the EU budget, and, when Brexit is complete, it will be necessary to examine the impact on their stock markets and how their contribution is affected, in terms of profit or loss. However, for the countries contributing least, the results of the analysis will guide the decision-makers and indicate how to safeguard the countries from going over budget if the UK leaves the EU, as the countries contributing least do not have powerful economies and a misjudgment will result in wrong investment opportunities and loss. Hence, the result of stock analysis with respect to Brexit for both groups of countries is essential, to take an optimal decision regarding stock investments. Moreover, it is also clear that the proposed deep learning model works better than traditional machine learning algorithms, i.e., linear regression and support vector regression, in terms of RMSE and MAE. In major contributing countries, the MAE of the deep learning algorithm is about 49.35 less than linear regression and 1.7 times less than support vector regression, when analyzing tweets in the UK. Similarly, in the countries contributing least, the deep learning method also outperformed when analyzing tweets in Portugal, in comparison with other machine learning classifiers. This study is helpful for the various business investors and decision-makers, as it completely portrays an analysis of the stock exchanges of EU nations from two different perspectives.
In the future, this work can be extended by adding more events, including economic and political happenings from each country, to analyze its impact on stocks. As the growth of social media that has been seen in the last few years is enormous, researchers are mining opinions from them according to their needs. Many social media platforms have seen such growth, but Twitter is the only platform being used for sentiment analysis, even though a huge audience is also on Facebook. In future studies, the use of more than one social media platform will be used to extract sentiments for any specific event. This collection of sentiments from more than one platform will be stronger and more authentic. In the future, we also want to incorporate more parallel events that occur during this phase, to improve the prediction results.

Informed Consent Statement: Not Applicable.
Data Availability Statement: The datasets are publicly available and can also be obtained from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.