BRICS Capital Markets Co-Movement Analysis and Forecasting

: The present study analyses BRICS (Brazil, Russia, India, China, South Africa) capital markets in both time and frequency domain using wavelets. We used artiﬁcial neural network techniques to forecast the co-movement among BRICS capital markets. Wavelet coherence and clustering estimates uncover the interesting dynamics among the BRICS capital markets co-movement. A wavelet coherence diagram shows a clear contagion effect among BRICS nations, and it favors short period investments over longer period investments. Overall study estimates indicate that co-movement among BRICS nations signiﬁcantly differs statistically at different levels. Except for China during the great ﬁnancial crisis period, signiﬁcant levels of co-movement were observed between other BRICS nations and that lasted for a longer period of time. A wavelet clustering diagram demonstrates that investors would not get any substantial beneﬁts of diversiﬁcation by investing only in the ‘Russia and China’ or ‘India and South Africa’ capital markets. Lastly, the study attempts to forecast the BRICS capital market co-movement using two different types of neural networks. Further, RMSE (Root Mean Square Error) values conﬁrm the correctness of the forecasting model. The present study answers the key question, “What kind of integration and globalization framework do we need for sustainable development?”.


Introduction
Finance literature in the last few decades witnessed a series of developments both in the developed and the developing capital markets across the globe. Due to globalisation, today's capital markets are inter-linked and that makes capital markets more unpredictable due to the presence of several known & unknown risk factors. Different levels of integration among the global capital markets made investor jobs more challenging in calculating expected returns for a specific market. Unforeseen risks are everywhere and any unforeseen event in the capital market can cause serious damage, especially in the tail data of distribution (Maiti 2021). To avoid such damage, investors used to diversify their investment in different assets and capital markets (Vukovic et al. 2019). Seminal work by Markowitz (1952) also suggests that investors can diversify their investment risk by investing in the negatively correlated international capital markets, followed by Grubel's (1968) work on "Internationally diversified portfolios: welfare gains and capital flows," which opens up the discussion on the importance of international capital markets on investment diversification among researchers. Further, Levy and Sarnat (1970); Kasa (1992); Forbes and Rigobon (2002); Johnson and Soenen (2003); Brooks and Del Negro (2004); Syriopoulos (2007) and the studies of others augmented the importance of international portfolio diversifications and linkages among the capital markets across the globe.
Previous studies deployed different methods to study the linkages between the capital markets across the globe as discussed below. Seminal work by Granger and Morgenstern (1970) used simple correlations to study the inter linkage between the stock markets and thereafter more advanced techniques like cointegration, rolling window correlations, VAR (vector autoregression) models, VEC (vector error correction) models, and GARCH (generalized auto regressive conditional heteroskedasticity). These models are used by a notable number of studies. Arshanapalli and Doukas (1993); Ratanapakorn and Sharma (2002); Ahlgren and Antell (2002); Chan et al. (1997); Chaudhuri (1997); Patel (2017), and others used cointegration to study linkages between stock markets. Some studies, such as Islam (2014), use VAR models and Kang and Yoon (2011) used the GARCH model to study linkages between the stock markets. As mentioned above, all of the studies used time series data setup either in the time or the frequency domain. Financial markets deal with several interacting agents and to understand such complex interacting systems a single aspect provides incomplete information. Wavelet analysis made it possible to study the time series in the time frequency domain. Wavelets made it possible to see the hidden interactions among the two time series, which are difficult to observe through any other possible available advanced econometric tools; and, moreover, wavelet analysis is a model free approach. These properties make wavelet analysis special and superior over other available advanced econometric tools. In the last few decades, wavelet analysis has been extensible in different scientific fields like image processing, DNA analysis, optics research, and signal processing, etc., but recently its application equally gained importance in finance literature.
The present study is not the first study that applies wavelets to analyze capital market co-movement. Earlier studies by Shik Lee (2004); Rua and Nunes (2009);Dima et al. (2015); Maiti et al. (2020a); Qureshi et al. (2020); Vukovic et al. (2021); Karim et al. (2021), and others, used wavelet analysis in finance research. Presently, the economies of BRICS nations are leveraging their financial sector and capital markets. Additionally, according to the IMF (International Monetary Fund), the BRICS capital market has the potential to double by 2020. That justifies the importance of the BRICS nations as a potential market for investment in the coming future by international investors, and at the same time it is important to understand the market dynamics of each of these markets due to the presence of different specific risk factors (Maiti andBalakrishnan 2018, 2020). Before making investment decisions on BRICS capital markets, investors must understand the complete dynamics behind these BRICS capital markets. The present study on BRICS capital market co-movement is unique in at least four ways: first, it uses longer time period data and in daily frequency; and second, to analyze BRICS capital market co-movement, the present study uses both discrete and continuous wavelet transform. Thirdly, this study uses wavelet clustering to identify, discriminate, and localize clusters in multidimensional space. Finally, the study made an attempt to forecast the BRICS capital market co-movement nature using the nonlinear techniques such as artificial neural networks. Overall, the present study answers the key question, "What kind of integration and globalization framework do we need for sustainable development?" This has a significant public policy content.
The rest of the paper is structured as follows: Review of Literature, Data and Methodology, Main Results, and Conclusion.

Review of Literature
Capital and stock market interdependence has been studied as an essential subject in international finance from numerous authors (Granger and Morgenstern 1970;Malliaris and Urrutia 1992;Wang et al. 2003;Shik Lee 2004;Kang and Yoon 2011;Aloui and Hkiri 2014;Aggarwal and Raja 2019;Ramos-Requena et al. 2020). Xu and Hamori (2012) studied capital dynamic linkages between the BRICS countries and the US pre and post crisis in 2008. The authors used an autoregressive model for the conditional mean and the exponential generalized autoregressive conditional heteroskedasticity (EGARCH) model to study the underlying relationships in the mean and in the variance. They found that during the crisis capital international transmission (stock prices) between the BRICS and the US weakened in both the mean and the variance. Previously, similar studies (Malliaris and Urrutia 1992;Wang et al. 2003) used the generalized impulse response analysis to examine the dynamic causal linkages and relationships of stock markets developed countries (Malliaris and Urrutia 1992) and emerging countries (Wang et al. 2003). In recent years, Hung (2019) used wavelet coherence to analyze the short-term and the long-term dynamics between equity market integration of China and of Southeast Asia. He found a positive linkage between variables and frequency changes in the pattern of the co-movements after the 2008 crisis between these countries. Similar issues in the same region are already analyzed by Sznajderska (2019) and Lau and Sheng (2018), confirming strong market impacts and connections. For the case of BRICS countries, such studies were previously conducted by Kao et al. (2018) and Aggarwal and Raja (2019). All authors found a stable long-run underlying relationship between the variables (Aggarwal and Raja 2019) and interdependence between emerging markets (Kao et al. 2018). However, the research of Mensi et al. (2018) did not find a positive linkage between all tested variables in the BRICS case (for example, for the gold prices). It indicates that not all capital variables behave the same in the underlying relationships. Even more, the global financial crisis influence made a decoupling effect for most BRICS markets for the period of the early stages of the crises Dimitriou et al. (2013). Mensi et al. (2017) finds a decoupling effect just for Russia (compared to other BRICS members).
Measuring of the stock market co-movement has increasingly become the subject of scholars' analysis in recent years due to the important practical implication for the portfolio's allocation and hedging strategies (Aloui and Hkiri 2014). Popularization of wavelet coherence contributes to the fact that the mathematical model can give simple insight into co-movement among international stock markets by previously used decomposition of the time series (Aloui and Hkiri 2014;Yang et al. 2017;Hung 2019;Maiti et al. 2020a). In the last few years, numerous studies have used wavelet coherence in their research of comovements and frequency changes in international markets (e.g., Maiti et al. 2020a;Hung 2019;Raza et al. 2019;Mensi et al. 2018;Yang et al. 2017). Mensi et al. (2018) analyzed BRICS countries' capital co-movements. They used the wavelet approach to test the strengths of co-movement commodity prices between these countries and the influence of the global financial crisis. They also found that portfolio risk is affected by co-movements between stock and oil markets. In some other studies, authors analyzed the differences in the asset return co-movement of the BRICS and of developed economies (Lehkonen and Heimonen 2014). The study used wavelet analysis as inputs for the dynamic conditional correlation framework. They found that the return level of stock market co-movement depends on regional aspects (not only the whole country), level of development, and the timescale of returns. Also, not all BRICS members showed the same co-movement and the dynamic conditional correlations. In addition to this evidence, Lehkonen and Heimonen (2014); Rua and Nunes (2009);and De Jong and De Roon (2005) found that the degree of stock return co-movement varies across different return frequencies.
For the last 30 years, there has been growing attention from researchers to use neural network models in financial forecasting (Vukovic et al. 2020;Vyklyuk et al. 2013). According to Ko and Lin (2008), this growing attention is due to their attribute to imitate elastic nonlinear modeling relationship capabilities. Majhi et al. (2007) argue that attribute is commercial applications and attractive benefits for financial players. Neural network models are most often used in analyses and predictions in finance for portfolio optimization and for forecasting financial performance (Forti et al. 2004;Liu and Wang 2006;Fernández and Gómez 2007;Zhang and Wu 2009;Vukovic et al. 2020), financial ratio analysis and forecasting (Eakins and Stansell 2003;Lin 2006, 2008), capital (cryptocurrency and stocks) markets forecasting (Maiti et al. 2020b; Maake and Van Zyl 2020; Dai et al.  Maake and Van Zyl (2020) analyzed and forecasted BRICS financial markets. They used artificial neural networks (ANN) to forecast individual stocks across BRICS studied markets. Their study implies ANN is the recommended tool to uncover hidden orders in BRICS markets data. Dai et al. (2012) forecast Asian stock markets with neural network models. The authors found that the stock index prediction model was a good alternative for Asian stock market indices. For the variables affecting broad international markets, we will single out the analysis of Maiti et al. (2020a). The study used neural networks to forecast crypto-currency co-movement. They found that linear models are inadequate on the test set for ANN and LSTM (long short-term memory). According to their findings, neural networks have a much lower error in calculations and forecasting on the test data and LSTM offers even better forecasted results. Previously, (in a similar study, but with different variables) LSTM and ANN techniques were used to forecast Sharpe ratios and investor portfolio positions for the European Union debt market (Vukovic et al. 2020). The authors found that neural networks are appropriate in forecasting nonlinear time lag series with an accuracy of 82% in test cases.
Based on the previously discussed literature, our goal is to apply the artificial neural network technique to forecast co-movement among BRICS capital markets. Before forecasting, we will use wavelet coherence to analyze the dynamics among the BRICS capital markets. There is a big gap in literacy with ANN models based on wavelet coherence data. With this study, we contribute to encouraging future similar research.

Data and Methodology
This study uses daily data for a period from 10 December 1999 to 17 January 2019 for Brazil (Brazil Sao Paulo Stock Exchange Index-IBOV), Russia (MOEX Russia Index-INDEXCF), India (Sensex), China (Shanghai Composite Index-SHCOMP), and South Africa (JALSH Index). From this, daily returns are calculated and used in the analysis.

Wavelet Analysis
To critically analyze the co-movement among the BRICS nations, the study used wavelet coherence and wavelet clustering diagrams. The entire wavelet analysis is conducted by using the "biwavelet 1 " package in R programming.

Wavelet Coherence
In this study, wavelet coherence is used to analyze the continuous co-movement between the pairs at different time and frequency domains (see Torrence and Webster 1999). The wavelet coherence could be perceived as a measure of local correlation of the two time series both in time and in scale. This procedure is analogous to coherence in a Fourier analysis. It is defined as the squared absolute value of the smoothed cross wavelet spectra normalized by the product of the smoothed individual wavelet power spectra of each series as shown in Equation (1).
The study defines the cross wavelet transform of two time series x(t) and y(t) with the continuous wavelet transforms W x (u, s) and W y (u, s), respectively. Then, cross wavelet power as W xy (u, s) and S is a smoothing operator. Without smoothing, the wavelet coherence is equal to one at all scales. The squared wavelet coherence coefficient is in the range 0 ≤ R 2 (u, s) ≤ 1.

Wavelet Clustering
Risks 2022, 10, 88 5 of 13 The study uses wavelet clustering to identify, discriminate, and localize clusters in multidimensional space. It uses Ward's like hierarchical clustering algorithm as explained in Chavent et al. (2018) and as shown in Equation (2).
where d ij is the Euclidean distance between the data points. Forecasting

Artificial Neural Network Forecasting
Our previous calculations on these and similar data have shown that classical forecasting methods show poor results due to the existing nonlinear dependence. Nonlinear analytical methods, such as neural networks, work best for such data.
Therefore, the study deploys two types of neural networks (see Vukovic et al. 2020;Maiti et al. 2020b): classical multilayer back-propagation perceptron and modern LSTM recurrent neural network for forecasting BRICS capital market co-movement. Python was chosen as the programming language. TensorFlow from Google was used as a library for deep learning for the neural network. The structure of the neural network is presented in Figure 1. The study uses wavelet clustering to identify, discriminate, and localize clusters in multidimensional space. It uses Ward's like hierarchical clustering algorithm as explained in Chavent et al. (2018) and as shown in Equation (2).
where dij is the Euclidean distance between the data points.

Artificial Neural Network Forecasting
Our previous calculations on these and similar data have shown that classical forecasting methods show poor results due to the existing nonlinear dependence. Nonlinear analytical methods, such as neural networks, work best for such data.
Therefore, the study deploys two types of neural networks (see Vukovic et al. 2020;Maiti et al. 2020): classical multilayer back-propagation perceptron and modern LSTM recurrent neural network for forecasting BRICS capital market co-movement. Python was chosen as the programming language. TensorFlow from Google was used as a library for deep learning for the neural network. The structure of the neural network is presented in Figure 1.

Explanatory Variables
Descriptive statistics of the explanatory variables is shown in Table 1. Russia's MOEX Index-INDEXCF mean daily return (0.059%) is high among the BRICS (Brazil, Russia, India, China, South Africa) nations. Similarly, China's Shanghai Composite Index-SHCOMP has low mean daily returns (0.013%) among the BRICS nations. All the time series have high kurtosis similar to Karim et al. (2021). Figure 2 shows Russia's MOEX Russia Index-INDEXCF has a higher volatility and standard deviation in mean daily returns pattern, whereas Brazil has a lower volatility.

Explanatory Variables
Descriptive statistics of the explanatory variables is shown in Table 1. Russia's MOEX Index-INDEXCF mean daily return (0.059%) is high among the BRICS (Brazil, Russia, India, China, South Africa) nations. Similarly, China's Shanghai Composite Index-SHCOMP has low mean daily returns (0.013%) among the BRICS nations. All the time series have high kurtosis similar to Karim et al. (2021). Figure 2 shows Russia's MOEX Russia Index-INDEXCF has a higher volatility and standard deviation in mean daily returns pattern, whereas Brazil has a lower volatility.

Wavelet Coherence
Wavelet coherence (see Figure 3) is used to locate the time localized common pattern between the two time series. These common patterns of behavior between the two time series may arise due to two reasons. In situation one, one time series is responsible for influencing the other and the other is affected by an unobserved mechanism that influences both time series. Many time series are non-stationary which implies that such series frequency changes over time. Wavelet coherence provides an important coherence measure to study such times series. Situations where one time series is responsible for influencing the other is further interpreted by the phase of the wavelet cross spectrum to identify the relative lead or lag between the two time series. The wavelet cross spectrum defines the relative lead or lag between coherent components where coherence exceeds 0.5 in the regions of the time-frequency plane. The direction of the arrows in the regions of the time-frequency plane indicates the phase difference between the two time series. The direction of the phase arrows indicates the following: right oriented: in-phase; left oriented: anti-phase; down oriented: X leading Y by 90 degrees; similarly, up oriented: Y leading X by 90 degrees. A white dashed line in the regions of the time-frequency plane indicates the cone of influence boundary. White marks the locations of wavefield decomposition where the series is significantly coherent. The horizontal axis in the diagrams represents daily data points from 10 December 1999 to 17 January 2019 and the vertical axis represents different scales. Figure 3 shows a clear contagion effect among BRICS nations. The Brazil-Russia pair wavelet coherence appears to be significant for (8-16 scale) and onward level during the great financial crisis period. The phase arrow toward right up indicates that Russia leads Brazil for the Brazil-Russia pair. Analogous estimates are obtained for Brazil-India, Brazil-South Africa, Russia-South Africa, India-South Africa (India leads) and Russia-

Wavelet Analysis Wavelet Coherence
Wavelet coherence (see Figure 3) is used to locate the time localized common pattern between the two time series. These common patterns of behavior between the two time series may arise due to two reasons. In situation one, one time series is responsible for influencing the other and the other is affected by an unobserved mechanism that influences both time series. Many time series are non-stationary which implies that such series frequency changes over time. Wavelet coherence provides an important coherence measure to study such times series. Situations where one time series is responsible for influencing the other is further interpreted by the phase of the wavelet cross spectrum to identify the relative lead or lag between the two time series. The wavelet cross spectrum defines the relative lead or lag between coherent components where coherence exceeds 0.5 in the regions of the time-frequency plane. The direction of the arrows in the regions of the time-frequency plane indicates the phase difference between the two time series. The direction of the phase arrows indicates the following: right oriented: in-phase; left oriented: anti-phase; down oriented: X leading Y by 90 degrees; similarly, up oriented: Y leading X by 90 degrees. A white dashed line in the regions of the time-frequency plane indicates the cone of influence boundary. White marks the locations of wavefield decomposition where the series is significantly coherent. The horizontal axis in the diagrams represents daily data points from 10 December 1999 to 17 January 2019 and the vertical axis represents different scales. of time. The study findings are in line with the previous findings that support global contagion may be of longer duration due to the ripple effect of several regional crashes. During the great financial crisis, some levels of co-movement were observed between China and other BRICS nations but it lasted for a shorter period of time similar to Forbes and Rigobon (2002). Wavelet Clustering Figure 4 shows the wavelet clustering of BRICS capital markets. In Figure 4, the vertical line shows the dissimilarity and the horizontal line shows the countries (BRICS). The dissimilarity is less significant than the correlation between the clusters. Two clusters consist of 'Russia and China' and 'India and South Africa'. Among these two clusters: the 'India and South Africa' dissimilarity distance is slightly higher than the 'Russia and China' cluster. It indicates that portfolio diversification is not possible by investing exclusively in the 'Russia and China' or the 'India and South Africa markets'. Brazil's dissimilarity distance is higher among all the BRICS nations, and it is in line with Rikhotso and Simo-Kengne (2022).  Figure 3 shows a clear contagion effect among BRICS nations. The Brazil-Russia pair wavelet coherence appears to be significant for (8-16 scale) and onward level during the great financial crisis period. The phase arrow toward right up indicates that Russia leads Brazil for the Brazil-Russia pair. Analogous estimates are obtained for Brazil-India, Brazil-South Africa, Russia-South Africa, India-South Africa (India leads) and Russia-India pairs. Except for China during the great financial crisis period, significant levels of co-movement were observed between other BRICS nations, which lasted for a long period of time. The study findings are in line with the previous findings that support global contagion may be of longer duration due to the ripple effect of several regional crashes. During the great financial crisis, some levels of co-movement were observed between China and other BRICS nations but it lasted for a shorter period of time similar to Forbes and Rigobon (2002).
Wavelet Clustering Figure 4 shows the wavelet clustering of BRICS capital markets. In Figure 4, the vertical line shows the dissimilarity and the horizontal line shows the countries (BRICS). The dissimilarity is less significant than the correlation between the clusters. Two clusters consist of 'Russia and China' and 'India and South Africa'. Among these two clusters: the 'India and South Africa' dissimilarity distance is slightly higher than the 'Russia and China' cluster. It indicates that portfolio diversification is not possible by investing exclusively in the 'Russia and China' or the 'India and South Africa markets'. Brazil's dissimilarity distance is higher among all the BRICS nations, and it is in line with Rikhotso and Simo-Kengne (2022).

Forecasting
Wavelet estimates confirm that there are co-movements among the BRICS nations. To forecast such co-movements, the present study used neural networks. The objective was to construct a forecast for seven days and for one year as a variation of data in one country = , is affected by another = , . The study employed data for five different countries. So, there are only 20 different combinations. Considering that for the weekly and the annual forecast, it is necessary to build 2 different models, and the number of different models increases to 40. The database consists of 4765 records. In the next step, it is necessary to transform time series into the next training sample consisting of tuples of shifted data to take into account the influence of one time series on another: where n-number of time lags (days) that are taken into account in the input time series for forecasting, m-time forecast lag. Since each field represents a vertical downward shift of the initial time series and -a vertical upward shift of the field , the total number of entries will be reduced by the value n + m so as with such a transformation fields containing NULL values appear, and they should be deleted. Thus, the fields , … , are considered as inputs and d , -output fields. Forecasting for a week was taken into account as the data for the two previous weeks affecting the next week in another country: n = 14, m = 7. The annual dynamics of the input time series data was considered: n = 355, m = 355.
Two types of neural networks were tested for forecasting: multilayer backpropagation perceptron and LSTM recurrent neural network. As test calculations showed, these two neural networks showed similar results, but LSTM training lasted an order of magnitude longer. Therefore, ANN was used to study 40 different data sets. The best results were obtained for the following configuration: the number of hidden layers-2, the number of neurons in each hidden layer-200, the activation function-the "relu", the initialization of weight factors-random in normal distribution, optimizer-"adam", loss coefficient-mean squared error, number of epochs-10,000, and the criterion for stopping learning was the stopping of a decrease in the root-mean-square error (RMSE) of the test set during 10 epochs of training.
The data set was divided into training and tests in a proportion of 80/20. Where the last 20% rows of the data set were considered to be a test. There were dense-hidden layers, training-data set for learning, loss-coefficients of learning error, and adamlearning optimization function. The accuracy of training can be estimated by comparing the test data with the prediction according to the neural network (Figure 1). Figure 5 shows the annual comparison of forecast data with real data between the country pairs,

Forecasting
Wavelet estimates confirm that there are co-movements among the BRICS nations. To forecast such co-movements, the present study used neural networks. The objective was to construct a forecast for seven days and for one year as a variation of data in one country D in t = {d} in t=1,4765 is affected by another D out t = {d} out t=1,4765 . The study employed data for five different countries. So, there are only 20 different combinations. Considering that for the weekly and the annual forecast, it is necessary to build 2 different models, and the number of different models increases to 40. The database consists of 4765 records. In the next step, it is necessary to transform time series into the next training sample consisting of tuples of shifted data to take into account the influence of one time series on another: where n-number of time lags (days) that are taken into account in the input time series for forecasting, m-time forecast lag. Since each field d in t−i represents a vertical downward shift of the initial time series d in t and d out t+j -a vertical upward shift of the field d out t , the total number of entries will be reduced by the value n + m so as with such a transformation fields containing NULL values appear, and they should be deleted. Thus, the fields d in t−n , . . . , d in t are considered as inputs and d out t , d out t+m -output fields. Forecasting for a week was taken into account as the data for the two previous weeks affecting the next week in another country: n = 14, m = 7. The annual dynamics of the input time series data was considered: n = 355, m = 355.
Two types of neural networks were tested for forecasting: multilayer back-propagation perceptron and LSTM recurrent neural network. As test calculations showed, these two neural networks showed similar results, but LSTM training lasted an order of magnitude longer. Therefore, ANN was used to study 40 different data sets. The best results were obtained for the following configuration: the number of hidden layers-2, the number of neurons in each hidden layer-200, the activation function-the "relu", the initialization of weight factors-random in normal distribution, optimizer-"adam", loss coefficientmean squared error, number of epochs-10,000, and the criterion for stopping learning was the stopping of a decrease in the root-mean-square error (RMSE) of the test set during 10 epochs of training.
The data set was divided into training and tests in a proportion of 80/20. Where the last 20% rows of the data set were considered to be a test. There were dense-hidden layers, training-data set for learning, loss-coefficients of learning error, and adam-learning optimization function. The accuracy of training can be estimated by comparing the test data with the prediction according to the neural network (Figure 1). Figure 5 shows the annual comparison of forecast data with real data between the country pairs, respectively.
It also shows that in most of the cases our neural network model was found to be accurate, especially in the case of Brazil with other countries as compared to the other cases. ANN forecasting for the following pairs was found to be closer to accurate for the following pairs: Russia-Brazil, Russia-India, China-India, and South Africa-Brazil. Then, for weekly and annual forecasting, the data set was transformed into a next set of tuples: That is, each row was a tuple of input data. The last record of this sample was applied to the input of the neural network. The output received a forecast for a week and a year depending on the structure of the neural network. The resulting one year forecasts are presented in Figure 5a,b. The obtained RMSE for these calculations are represented in Table 2. One can see from Table 2, RMSE for the week forecasting are a little less than for the year in most cases. The calculation impact SA on other countries showed a smaller yearly RMSE than for the weekly. It also confirms the robustness of the forecasting model as the RMSE values are less and closer to zero.
Risks 2022, 10, x FOR PEER REVIEW 9 of 13 respectively. It also shows that in most of the cases our neural network model was found to be accurate, especially in the case of Brazil with other countries as compared to the other cases. ANN forecasting for the following pairs was found to be closer to accurate for the following pairs: Russia-Brazil, Russia-India, China-India, and South Africa-Brazil. Then, for weekly and annual forecasting, the data set was transformed into a next set of tuples: That is, each row was a tuple of input data. The last record of this sample was applied to the input of the neural network. The output received a forecast for a week and a year depending on the structure of the neural network. The resulting one year forecasts are presented in Figure 5a,b. The obtained RMSE for these calculations are represented in Table 2. One can see from Table 2, RMSE for the week forecasting are a little less than for the year in most cases. The calculation impact SA on other countries showed a smaller yearly RMSE than for the weekly. It also confirms the robustness of the forecasting model as the RMSE values are less and closer to zero.

Conclusions
Capital markets are often termed as the barometer of a country's economy as they are directly related to the country's economic performance. Currently, due to openness and globalization, most capital markets are interrelated so that any event in one market will affect the other markets. So, it is important for policy makers and market participants to know the degree or level to which capital markets are interrelated with each other. To diversify risk, investors always try to invest in the markets which are less correlated or that have low correlations. Against this backdrop, the present study analyzes BRICS capital market co-movement using both discrete and continuous wavelet transform in a time frequency domain. The wavelet coherence diagram shows a clear contagion effect among BRICS nations, and it favors short period investments over longer period investments. Except for China during the great financial crisis period, a significant level of coherence was observed between other BRICS nations, which lasted for a longer period.

Conclusions
Capital markets are often termed as the barometer of a country's economy as they are directly related to the country's economic performance. Currently, due to openness and globalization, most capital markets are interrelated so that any event in one market will affect the other markets. So, it is important for policy makers and market participants to know the degree or level to which capital markets are interrelated with each other. To diversify risk, investors always try to invest in the markets which are less correlated or that have low correlations. Against this backdrop, the present study analyzes BRICS capital market co-movement using both discrete and continuous wavelet transform in a time frequency domain. The wavelet coherence diagram shows a clear contagion effect among BRICS nations, and it favors short period investments over longer period investments. Except for China during the great financial crisis period, a significant level of coherence was observed between other BRICS nations, which lasted for a longer period. A wavelet clustering diagram shows that the 'India and South Africa' dissimilarity distance is slightly higher than that of 'Russia and China'. Wavelet clustering also suggests that portfolio diversification benefits are not possible by investing exclusively in the 'Russia and China' or in the 'India and South Africa' markets. Brazil's dissimilarity distance is higher among all the BRICS nations. Overall study implications are that co-movement among BRICS nations differs at different time frequency domains. The study findings are in a similar line with Bekaert and Harvey (1995); Goetzmann et al. (2005), etc., whose findings in a global context support co-movement among BRICS nations that differs at different time frequency domains. Hence, it is advisable that global investors who are interested in investing in BRICS nations should include Brazil in the portfolio to gain maximum benefits from the diversification (Qureshi et al. 2020). The present study further tested two types of neural networks for forecasting: multilayer back-propagation perceptron and LSTM recurrent neural network. Study test calculations show these two neural networks showed similar results, but LSTM training lasted an order of magnitude longer. Therefore, ANN was used to study 40 different data sets. The study results show that in most cases, our neural network model was found to be significantly closer to accurate as RMSE values confirm the robustness of the forecasting model.
Further research could use tick data or real time data to examine BRICS integrations. Future studies could quantify the information flow between BRICS and different macroeconomic variables.