Investor sentiment and sustainable investment: evidence from North African stock markets

This paper examines the connectedness between investor sentiment and returns and volatility on environmental, social, and governance (ESG) indices in Morocco and Egypt. Therefore, we construct a new investor sentiment index and use weekly data from January 2018 to December 2023, along with the time, frequency and quantile connected-ness methods. The results show that investor sentiment sometimes influences the returns and volatility of the ESG indices, and sometimes it is influenced by them. This connectedness is stronger during distress events, namely, the COVID-19 outbreak and geopolitical tensions (the Russian-Ukrainian and Israeli-Palestinian conflicts). Furthermore, the spillover effect between sentiment and returns on the ESG indices is mainly due to short-term spillovers, except during the COVID-19 period, when long-term spillovers dominate. However, the spillover effect between sentiment and volatility on the ESG indices is mainly due to long-term spillover, especially during the COVID-19 outbreak and the Russia-Ukraine War, implying the persistence of shock transmission due to high uncertainty. The findings also highlight the impact of market conditions on spillovers. These findings can help socially responsible investors successfully diversify their portfolios and adjust their strategy according to investor sentiment; they also have beneficial implications for policymakers in achieving sustainable development goals


Introduction
Sustainability has become a central concern in recent years.The Brundland Report for the World Commission on Environment and Development [11] defines this concept as 'The development that meets the needs of the present without compromising the ability of future generations to meet their own needs' .In September 2015, the UN General Assembly adopted the 2030 Agenda for Sustainable Development with a set of Sustainable Development Goals.These goals are to be met in each country for the period 2016-2030.In this regard, stock markets can play an important role in promoting sustainability and contributing to the achievement of sustainable development goals.This includes the implementation of sustainability indices, which include only companies that meet specific environmental, social and governance (ESG) requirements.
ESG assesses a company's sustainability from a nonfinancial perspective, which involves the efficient management of environmental resources, the promotion of positive social relations and the maintenance of high standards of ethical conduct [7].It refers to the capacity of a company to perform in a way that preserves ecological integrity, social well-being, and principles of good governance, while simultaneously creating value for its shareholders [44].
Increasing concerns about sustainability are driving investors to focus on ESG performance.Therefore, ESGrelated stocks have received much attention from investors and are being included in their portfolios [25].This increasing attention can have a positive effect on ESG index returns in financial markets [19,45].
From a company's perspective, ESG performance can reinforce the brand reputation and loyalty of responsible companies [51], which helps attract loyal managers, investors, and customers [31].Loyal investors are incentivized by nonpecuniary rewards to invest in ESG assets and are hence unlikely to sell their investments, even during crises [29].Furthermore, companies that report ESG information gain financial support [45,58].In fact, rating agencies have embraced the principle of responsible investment, which integrates ESG issues into their rating methods, which implies that firms with better ESG scores receive better ratings [4] and thus lower interest rates.Consequently, ESG performance might improve companies' resilience to risk and help them receive financial support, particularly in times of crisis, as a reward for environmental sustainability [26].Several studies analyzed the impact of ESG scores on company performance [12,17,30,45,49,50,61].
From the perspective of behavioral finance, stock markets are not completely efficient, and investor sentiment might significantly influence asset prices [8,23,32,63].However, few studies examined the relationship between sentiment and sustainability indices using different proxies for investor sentiment.For instance, using consumer sentiment, Giannarakis et al. [27] and Pitoska et al. [57] showed that sentiment has a positive impact on sustainability indices.Using social network sentiment, López-Cabarcos et al. [43] found that sentiment has a greater impact on the S&P 500 Environmental and Socially Responsible Index than on the S&P 500 Index.El Ouadghiri et al. [19] employed the Google Search Volume Index as a proxy for investor attention and found that investors' attention to climate change and pollution has a significant positive impact on sustainability index returns.Based on 10 sentiment proxies, Dhasmana et al. [16] reported an asymmetric relationship between the ESG index and investor sentiment.
Nevertheless, studies dealing with spillovers between sentiment and sustainability indices are in short supply in the literature.Several studies analyzed spillovers between sentiment and other sustainable assets such as green bonds [53,55], but studies on spillovers between sentiment and ESG indices are limited.Examining the connectedness between sentiment and sustainability indices provides us with an in-depth understanding of how sentiment and ESG indices interact, which can provide valuable information to policymakers and pro-ESG investors.
Moreover, no study has examined this connectedness in North African markets.As this region is more sensitive to climate change, some countries, namely, Morocco and Egypt, have recently launched the ESG index on their stock exchanges.Therefore, the spillover effect between investor sentiment and sustainability indices should be carefully examined in these countries.It is noteworthy that although the study is limited to the North African region, it is of wider international interest, as it could encourage socially responsible investors from all over the world to invest in this region.This study also highlights the progress made by emerging countries in terms of sustainability, which is an international issue.
An interesting observation from the related literature is that different measures of sentiment have been used, which could yield mixed results.Accordingly, developing an aggregate sentiment index that encompasses important measures could be of great interest in this direction.
The goal of this paper is to examine the dynamic connectedness between our newly constructed 'sustainable investment sentiment index' and the returns and volatility of the ESG indices in North Africa.We include only Morocco and Egypt in this study because they are the only countries that have launched the ESG index on their stock markets in North Africa.Moreover, these countries could be representative of North Africa, as they have the largest stock markets in the region.
We make five contributions to the literature.First, our study is the first to examine the bidirectional effect between sentiment and returns and volatility on ESG indices, which provides a comprehensive study of this relationship.Second, we study this relationship in North Africa, where it has never been investigated before.Examining this region is particularly relevant because it is more sensitive to climate change, and growing interest among investors in sustainable investment has led some stock markets to introduce ESG indices recently.Third, we propose a new ESG-related sentiment index that overcomes the limitations of other sentiment proxies that take a single measure separately, which results in mixed findings.Therefore, we combine different measures into an aggregate index based on both qualitative and quantitative methods, which can lead to a highly accurate measure of sentiment.Fourth, our sample covers recent major events, namely, the COVID-19 outbreak and certain geopolitical tensions (the Russian-Ukrainian and Israeli-Palestinian conflicts), which offers useful insight into how these distress events influence the connectedness between sentiment and sustainability indices.Finally, by combining the latest proposed connectedness methods, we investigate the spillover effect over time, at different frequencies and under different market conditions by focusing on extreme events, such as the COVID-19 pandemic, the Russia-Ukraine war, and the Israeli-Palestinian conflict.This approach would provide more valuable information to investors, as it detects the market conditions under which investor sentiment can strongly predict the movements of ESG indices.
The rest of the paper is structured as follows.Section "Literature review" provides a brief review of relevant related studies.Section "Methodology and data" presents the methodology and data.Section "Results and discussion" outlines and discusses the empirical results of the study.Section "Conclusions" concludes.

Literature review
According to the efficiency market hypothesis [22], investors can process information rationally, which results in market efficiency in which prices reflect all available information.Nevertheless, this approach fails to explain market anomalies.In this sense, behavioral finance proves that investor sentiment might influence stock prices and explain many market anomalies [3,39].Therefore, including investor sentiment in investment decisions could improve portfolio profit [24].Investor sentiment can be defined as an investor's optimism or pessimism about stock market expectations [3].Several measures of investor sentiment have been proposed, including market proxies, newspaper sentiment, social media sentiment, the consumer confidence index, and the Google Search Volume Index.Specifically, using Twitter as a measure of mood, Bollen et al. [8] reported that investor mood can improve the accuracy of the DJIA index prediction.Clear evidence of the predictive capacity of Twitter sentiment on the S&P 500 Index was reached by Zhang et al. [65].By analyzing the linkage between social network sentiment and the S&P 500 Index, Piñeiro-Chousa et al. [54] highlighted the effect of experienced users' sentiment on S&P 500 returns.The inverse relationship between sentiment and stock market activity was also investigated.For instance, Kim and Kim [34] found that stock prices influence the sentiment contained in investors' posts on Yahoo!Finance.Similarly, Piñeiro-Chousa et al. [56] note that Tobin's Q, capitalization and the P/E ratio can affect investor sentiment obtained from posts on StockTwits.Thus, there is two-way feedback between stock markets and social network-based sentiment.
Da et al. [14] proposed the Google Search Volume Index (GSVI), which has become a popular tool for capturing investor attention.Several behavioral finance studies show that investor attention has an impact on asset pricing.In fact, stocks in the news or with high transaction volume attract more attention from investors, who thus become netbuyers of these stocks, causing a temporary increase in prices and a decrease in subsequent returns [5].With respect to this, Joseph et al. [33] argue that investor attention might predict excess returns and trading volume.To capture investor attention, various studies have widely used the GSVI to examine the linkage between investor attention and stock markets [13,59,60].These studies found evidence for the impact of investor attention on asset performance in the markets examined.
Due to climate change, social concerns and governance issues, investors are becoming increasingly aware of ESG investing and are focusing more on sustainable investment.Accordingly, many stock markets around the world have introduced ESG indices that include companies that meet environmental, social, and governance criteria.Although ESG indices are derived from general indices, they are more sensitive to market fluctuations than are general indices [50].This can be attributed to investor sentiment and, more specifically, to investors' sensitivity to sustainable investment.Some studies have examined the relationship between investor sentiment and ESG indices or sustainable companies.For example, López-Cabarcos et al. [43] showed that social network sentiment has a large effect on the volatility of the S&P 500 Environmental and Socially Responsible Index compared to its impact on the S&P 500 Index.Gutsche et al. [28] found that investors also value extra financial factors, such as feelings of warm glow or social norms, when making decisions on socially responsible investments.La Torre et al. [36] reported that ESG strategies positively affect the returns of a few firms, mostly belonging to specific sectors, such as energy and utilities.Dhasmana et al. [16] established an interconnection between the ESG index and investor sentiment.Using newspaper-based ESG sentiment, Liu et al. [41] found that ESG sentiment is positively associated with the volatility risk premium, especially the impact of environmental and social factors.Using the same approach, Yu et al. [64] showed that higher news-based ESG sentiment can lower stock price crash risk by reducing negative ESG incidents, information asymmetry, and agency costs.
Despite a few studies that analyzed the relationship between sentiment and ESG indices, no study has explored the spillover between sentiment and ESG index returns and volatility in a single study, especially in North Africa.Moreover, the studies reviewed earlier used various sentiment proxies separately, which might produce inconclusive results.While certain investors use internet searches, others are more present in social networks, and still others are targeted by direct surveys.Combining these different measures into an aggregate index can provide a highly accurate measure of investor sentiment.These issues are addressed in this study.

Methodology
We combine the latest methods to study the connectedness between investor sentiment and ESG indices over time, at different frequencies and under different market conditions.

Time-spillover approach of Diebold and Yilmaz [18] (DY [18])
To examine the spillover between sentiment and ESG indices in the time domain, we use the generalized forecast error variance decomposition (GFEVD) approach of Diebold and Yilmaz [18].The GFEVD at forecast horizon H ( θ jk (H )) , which can be interpreted as the effect a shock in variable k has on variable j in terms of its forecast error variance share, can be written in the following form: in which σ kk is the diagonal element matrix , h is a coefficient matrix (N × N ) with lag h.
θ jk (H) can be standardized as follows: in which θ jk (H ) denotes the directional spillover from variable k to variable j at H. The overall spillover can be represented as: The TO spillover calculates the directional spillover from variable j to all other variables in the system.It has the following form: The FROM spillover measures the directional spillover from all other variables in the system to variable j .It is defined as follows: (1) (3) The net directional spillover of variable j is represented as: The net pairwise spillover between variables k and j is measured using:

Frequency-spillover approach of Baruník and Křehlík [6] (BK [6])
The frequency connectedness [6], which is an advancement of the Diebold and Yilmaz's [18] approach, decomposes spillovers into high-frequency and lowfrequency spillovers.The first spillover states that the connectedness is the result of shocks that have a shortlived effect on the system, while the second spillover indicates that the connectedness is the result of shocks that cause structural changes within the system and leave a longer-term mark on the variables.Thus, we include the frequency spillover model in our study.
According to Baruník and Křehlík [6], � e −iω = h e −iωh � h represents the frequency response function obtained from the Fourier transform of the coefficient h with i = √ −1.The general- ized causation spectrum over frequencies ω ∈ (−π , π) is defined as: where � e −iω = h e −iωh � h represents the Fourier transform of the impulse response h , and θ jk (ω) indi- cates the proportion of the jth variable at a given fre- quency ω due to shocks in the kth variable.
The generalized variance decomposition at a certain frequency band d = (a, b) is described as: in which Ŵ j (ω) represents the power of the jth variable at a given frequency and is defined as: The normalized generalized variance decomposition at the frequency band d can be obtained as follows: (6) is the contribution over all frequencies.All GFEVD-based connectedness measures can be calculated in the same way as in ( 3)- (7).

Quantile connectedness approach of Ando et al. [2]
The approaches discussed earlier consider the meanbased VAR, which does not allow us to assess whether the comovement between the variables in the system depends on the strength (extreme quantile) and the nature of the shock (high or low quantile).To this end, we include in our study the connectedness approach of Ando et al. [2], which is a modified version of the meanbased measures that considers both extreme positive structural shocks (i.e., upper quantiles) and extreme negative structural shocks (i.e., lower quantiles).To calculate the connectedness metrics at each quantile τ, we first estimate a quantile vector autoregression, QVAR(p) , which is defined as follows: in which y t and y t−k , k = 1, . . ., p are N × 1-dimensional endogenous variable vectors, τ stands for the quantile of interest and is in [0, 1] , p represents the lag length of the QVAR model, µ(τ ) denotes the N × 1-dimensional conditional mean vector, p k � k (τ ) is an N × N-dimensional QVAR coefficient matrix, and u t (τ ) represents the N × 1-dimensional error vector, which has an N × N -dimensional error variance-covariance matrix (τ ).To transform the QVAR(p) to its quantile vector moving average representation, QVMA(∞), we use Wold's theorem: Then, following Koop et al. [35] and Pesaran and Shin [52], the GFEVD at forecast horizon H , which illustrates the impact a shock in variable k has on variable j , is calculated as follows: in which e j stands for a zero vector with unity on the j th position.In the decomposition matrix, the normalization of elements is as follows: The normalization results in the following equalities: Next, following Diebold and Yilmaz [18], all GFEVDbased connectedness measures can be calculated as follows.The total connectedness index (TCI), which measures the average level of total spillover, is given by: This measure can be viewed as a proxy for market uncertainty.
The total directional connectedness TO others is given by: The total directional connectedness FROM others is expressed as follows: The NET total directional spillover is as follows: If NETj > 0 , variable j impacts all other variables more than being impacted by them.In this case, it is considered a net transmitter of shocks; otherwise, it is a net receiver.
The net pairwise connectedness ( NPDC ) is calculated by: If NPDC jk (H) > 0 , this implies that the variable k influences the variable j more than the variable j influ- ences the variable k , and thereby the variable k dominates the variable j , and vice versa.

Data
To test the spillover between investor sentiment and sustainable investment returns in Morocco and Egypt, we use weekly data from the Casablanca ESG and S&P/EGX ESG indices.The Casablanca ESG and S&P/EGX ESG were launched in 2018 and 2010, respectively.Their purpose is to raise awareness of companies that perform well on the three parameters of environmental, social, and corporate governance responsibility relative to their market peers.The data obtained from the Moroccan (15) and Egyptian stock market websites cover the period from January 2018 to December 2023.The period under investigation is informative in terms of extreme events, as it covers the COVID-19 crisis and the years that followed, as well as geopolitical tensions (the ongoing wars between Russia and Ukraine and between Israel and Palestine).We include general market indices to control for general market conditions.For this purpose, we use the MASI index (for Morocco) and the EGX30 index (for Egypt).Based on the weekly closing prices, we calculate the first log difference of the time series to obtain the returns as follows: in which p it is the weekly closing price of the index i at time t , and p it−1 is the weekly closing price of the index i at time t − 1 .We use weekly data to avoid the nonsyn- chronous trading effect associated with daily data.
With respect to volatility, we use the conditional variance from the univariate GARCH model [9], which we apply to each return series to estimate the volatility series of the variables.In addition to the variables of interest, we include market volatility to control for general market conditions.Formally, the standard GARCH(p, q)1 model can be expressed as follows: in which p denotes the order of the moving average ARCH term, q stands for the order of the autoregressive GARCH term, y t expresses the conditional mean,h2 t is the conditional variance, ε 2 t is the squared residual, i are the ARCH parameters, γ j are the GARCH parameters, e t is a white noise process, and φ is a constant.
Regarding investor sentiment, we construct a new 'sustainable investment sentiment index' .Indeed, investors are becoming interested in sustainability criteria when making investment decisions.Sustainability refers to a company's ability to comply with ESG criteria, which includes the efficient management of environmental resources, the promotion of positive social relations and the maintenance of high standards of ethical conduct [7].Online ESG search, sustainability-related posts on social media, and public opinion on sustainability could (21) reflect investor sentiment toward ESG investing.Therefore, to accurately measure investment sentiment toward sustainable investment, we develop an aggregate index that combines three sentiment proxies widely used in the literature, namely, X sentiment (Twitter), the Google Search Volume Index (GSVI), and the consumer confidence index (CCI).For X (Twitter) sentiment, we collected daily posts related to sustainable investment using related keywords, such as "sustainable investment Morocco" ("sustainable investment Egypt"), "environmental, social, and governance criteria Morocco" ("environmental, social, and governance criteria Egypt"), and "ESG Morocco" ("ESG Egypt"), from X (Twitter) platform for the period 2018-2023.After cleaning the raw posts, we assigned each post a sentiment score using natural language processing. 2 Then, the weekly average sentiment was computed to form a time series of the weekly sentiment index using the following formula: in which TSent t stands for the weekly sentiment at time t , Sent it is the sentiment score of message i posted at time t , and N t is the number of messages posted at time t .This index ranges from −1 to 1, in which −1 is interpreted as extremely pessimistic and 1 as extremely optimistic, while a neutral tweet equals zero.As far as the GSVI is concerned, we use the GSVI of the topic 'Environmental, social, and governance criteria' 3 in Morocco and Egypt, obtained via Google Trends.The final component of our sentiment indicator is CCI. 4 The CCI provides insights into individuals' sentiments regarding their personal financial ability and purchasing behavior and regarding the economy as a whole.A value above 100 indicates an optimistic consumer attitude, while a value below 100 reflects a pessimistic attitude.The inclusion of the CCI in our index is justified for two reasons.First, the CCI controls for the effect of general economic conditions on investor sentiment.Second, the CCI survey includes many questions related to sustainability.All the values are normalized to the range [−1, 1].Next, based on Li et al. [38], we construct our sentiment index as follows: (23) , in which σ 2 represents the vari- ance respective of TSent , or GSVI or CCI.
Table 1 shows the descriptive statistics of the sentiment, return, and volatility series.Overall, the sentiment index in Morocco has a greater mean and lower dispersion than in Egypt.This indicates that Moroccans are more optimistic about sustainable investment than Egyptians are.Returns in Egypt have a lower mean than returns in Morocco, but they are more volatile in Egypt than in Morocco.We also observe that returns are negatively skewed because of negative changes in returns.Kurtosis is greater for all the return variables than in the normal distribution, which by construction equals 3. Thus, the distributions are leptokurtic, which is considered a stylized fact in financial markets.The volatility series are positively skewed and have a high kurtosis coefficient, implying a non-Gaussian distribution.The sentiment indices are also non-Gaussian, as evidenced by the skewness coefficient being positive, meaning that the distribution is skewed to the right due to positive changes in sentiment.Kurtosis values different from 3 confirm this nonnormality.The Jarque-Bera test of normality also corroborates the nonnormality of all variables.All these characteristics justify our methodology presented earlier.
To check the stationarity of the variables, we use the ADF test.All series show stationarity because the ADF unit root test is highly significant.The significant ARCH-LM test implies the presence of the ARCH effect (heteroscedasticity) in the return series, which justifies the use of the GARCH model to calculate volatility.

Spillover between investor sentiment and returns on ESG indices
From a static perspective, Table 2 presents the average connectedness results using the DY [18] and BK [6] frameworks.While DY [18] represents spillovers in the time domain, BK [6] decomposes these spillovers in terms of the frequency domain, i.e., short-term and long-term.The total connectedness index is 33.14% in Morocco and 30.85% in Egypt, suggesting that the Moroccan market is riskier than the Egyptian market.In the short term, the overall connectedness in Morocco is 31.81%,while it is 35.51% in Egypt, which indicates that the Egyptian financial market becomes riskier than the Moroccan market in the short term.However, in the long term, the Moroccan market is riskier than the Egyptian market.Considering the directional connectedness between sentiment and ESG returns, we observe that at the aggregate level, in both Morocco and Egypt, sentiment influences ESG returns less (0.45% in Morocco and 0.41% in Egypt) than it is influenced (0.82% in Morocco and 2% in Egypt), suggesting that sentiment is a net receiver of shocks from ESG returns.The impact of sentiment on ESG returns is driven by short-term rather than long-term shocks in  DY [18] denotes spillovers following Diebold and Yilmaz [18].BK [6] denotes the frequency domain connectedness following Baruník and Křehlík [6].The results are estimated based on the VAR approach, with a lag order of 1 for returns in Morocco (order 2 for volatilities) and 4 for returns in Egypt (order 4 for volatilities), which is chosen according to the Akaike Information Criterion (AIC).The index in bold is the total connectedness index calculated by Eq. (3).The "TO", is the shock transmission from one variable to all other variables, "FROM", is the shock received from other variables by one variable, and "NET", is the difference between TO and FROM, are calculated by Eqs. ( 4), ( 5) and ( 6), respectively.The jkth value is the directional connectedness from variable k to variable j and is calculated by Eq. (1 Net spillovers are negative for sentiment in both markets, indicating that sentiment is a net receiver of return shocks within the system.However, it appears that ESG returns are net receivers of shocks in Morocco but net transmitters of shocks in Egypt.Considering frequency spillovers, ESG returns are net receivers in the short term but net transmitters in the long term in Morocco, while the opposite is the case in Egypt.This implies that investing in ESG is less risky in the long term in Morocco than in Egypt, as net shock transmitters would be affected by a smaller number of risk sources.This provides an opportunity for a diversification strategy in both markets. Although full-sample spillovers offer a useful summary of average spillovers, they do not detect important cyclical patterns in spillovers emanating from economic and financial turbulence or from evolving investor behavior.The evolutionary approach to markets implies that the impact of investor behavior on stock markets varies over time [20,21,37,42].To capture this, we re-estimate the spillovers using a 52-week rolling window.Figure 1a, b displays the total spillover in the time domain in Morocco (a) and Egypt (b).It shows that the total connectedness index (TCI) is time-varying and event dependent.Specifically, a significant spike is observed at the onset of the COVID-19 outbreak in both markets, implying that the market risk was extremely high during the crisis (approximately 40% in Morocco and 60% in Egypt).A significant decline occurred in 2021, which coincided with the recovery period from the outbreak and the end of COVID-19-related measures in several countries.In early 2022 and late 2023, there was also an increase in the TCI, which corresponds to the Russia-Ukraine war and the Israeli-Palestinian conflict, respectively.This finding confirms Mensi et al. [46] that intense economic times generate feelings of fear and uncertainty, leading to significant spillovers.Additionally, we observe that the TCI is higher in Egypt most of the time than in Morocco, which indicates that the Egyptian market is riskier than the Moroccan market.
To thoroughly understand the sources of spillovers in the system, we examine the frequency dynamics of the connectedness, as market participants have heterogeneous anticipations and thus heterogeneous frequency responses to shocks.Figure 1c, d shows that the dynamic spillovers are determined by heterogeneous frequencies, which correspond to the heterogeneous beliefs and preferences among investors.However, we find that the spillovers are primarily driven by the short-term component, up to 3 weeks, apart from the period corresponding to the COVID-19 pandemic.This is because during periods when markets are prone to process information quickly, connectedness is created at high frequency, and thus, a shock in one variable in the system primarily affects short-term cyclical behavior.Nevertheless, when connectedness comes from a lower frequency, this indicates that shocks are being transmitted for longer periods.One explanation is that during periods of high uncertainty, shocks are being transmitted slowly and affect markets for longer, but after a period of high uncertainty, markets tend to stabilize and prosper, uncertainty and fear diminish, so shocks are transmitted more quickly through the system, and their influence diminishes after a few times, creating short-term spillovers.This is consistent with the conclusion of Baruník and Křehlík [6].Another observation from Fig. 1c, d is that while long-term spillovers dominate short-term spillovers for a short period in Egypt, this characteristic holds over a long period in Morocco.This implies that the COVID-19 crisis made Moroccan investors passive for a longer period than Egyptian investors.In contrast, the Russia-Ukraine war and Israeli-Palestinian conflict coincide with an increase in mainly short-term spillovers, indicating that shocks during these geopolitical tensions are short-lived.
Since we focus on the relationship between sentiment and the returns on the ESG indices, we calculated the time and frequency of pairwise spillovers between these two variables.Figure 2a, b depicts the variation over time in total spillovers between sentiment and the ESG index returns in Morocco (Fig. 2a) and Egypt (Fig. 2b).The findings reveal that sentiment switches from the net transmitter to the net recipient.Indeed, net transmission tends to be followed by net reception, implying a timevarying bidirectional relationship between sentiment and the returns of ESG indices.Specifically, we note that during 2019, sentiment influenced the returns of the ESG indices more than it was influenced by them, especially in the Egyptian market.This indicates a strong investors concern with sustainable investment, which is characterized by a high transmission of shocks to ESG indices.In contrast, in early 2022, sentiment becomes a net recipient of shocks from ESG indices, as COVID-19 increases the sensitivity of investors to shocks in sustainable investment, which might have a considerable impact on the returns of ESG indices in subsequent periods.Nonetheless, while sentiment is a net transmitter in 2021 and the first quarter of 2022 in Morocco, it is a net receiver in Egypt.Looking at the frequency domain depicted in Fig. 2c, d, we notice that, overall, the pairwise spillovers are mainly driven by the short-term component in Egypt and the long-term component in Morocco, except at the beginning of the COVID-19 crisis, when long-term spillovers dominate in both markets.Therefore, during the COVID-19 pandemic, long-term shocks that create uncertainty led to connectedness.This can be plausibly explained by the fact that strong uncertainty about the Now, it is clear that the connectedness between investor sentiment and the returns of the ESG indices is timevarying and event dependent.To further our analysis and explore the direction and magnitude of the dynamic connectedness between sentiment and the ESG indices under different market conditions, we used the quantile connectedness approach of Ando et al. [2].First, we estimate the average spillovers at the median and extreme quantiles (Table 3) before estimating the time-varying spillovers at different quantiles.We note that the TCI is greater under extreme market conditions (5th and 95th quantiles) in both markets than under normal conditions (at the median), which indicates that the markets are riskier under extreme conditions because of the impact of uncertainty, optimism, and pessimism that prevail in extreme market conditions, so that shocks in sentiment are transmitted to the system, creating strong connectedness.
The net directional spillovers between sentiment and ESG returns indicate that the impact of sentiment on ESG returns is lower under stable conditions (at the median) (3.61% in Morocco and 16.17% in Egypt) than under bearish market conditions (at the 5th quantile) (20.49% in Morocco and 19.23% in Egypt) or under bullish market conditions (at the 95th quantile) (20.29% in Morocco and 38.48% in Egypt).The same pattern can be observed when considering the influence of ESG returns on sentiment.
To capture the impacts of both market conditions and economic and geopolitical events, we re-estimate the results in a dynamic setting.Figure 3a, b plots the total quantile connectedness in Morocco (a) and Egypt (b).Warmer shades on the graph reflect greater levels of connectedness.Stronger connectedness in the system is observed during the lower and upper extreme quantiles, but as investor sentiment and market returns Table 3 Return and volatility spillover results at the median, 5th quantile and 95th quantile The variance decomposition is based on the QVAR approach of Ando et al. [2], estimated at the median in Panel A, lower tail (5th quantile) in Panel B, and upper tail (95th quantile) in Panel C, with a lag order of 1 for returns in Morocco (order 2 for volatilities) and 4 for returns in Egypt (order 4 for volatilities), which is chosen according to the Akaike Information Criterion (AIC).The total connectedness index in bold is calculated by Eq. ( 16).The "TO", is the shock transmission from one variable to all other variables, "FROM", is the shock received from other variables by one variable, and "NET", is the difference between TO and FROM, are calculated by Eqs. ( 17), ( 18) and (19), respectively.The jkth value is the directional connectedness from variable k to variable j and is calculated by Eq. (13) move toward the middle quantiles, the connectedness decreases significantly.Furthermore, we observe that during the COVID-19 period, the connectedness is more pronounced in the lower quantiles than in the other quantiles, which highlights that the crisis negatively impacts returns and amplifies risk in the market.Our findings are consistent with those of Deng et al. [15], who revealed that the spillover between investor attention and environmentally friendly stocks is asymmetric.This can be attributed to investors' responses to bad news emanating from the ESG market.However, this result is not in line with that of Nyakurukwa and Seetharam [48], who reported that there is no statistically significant investor response to negative ESG-related news.
For the pairwise spillover between sentiment and the returns on the ESG indices, the estimation results are shown in Fig. 4a, b.Warmer shades on the graphs indicate net transmission.The results for Morocco (Fig. 4a) are different from those for Egypt (Fig. 4b).In fact, sentiment in Morocco is steadily receiving shocks from the ESG indices, except for some periods when it is a net emitter.The receipt of shocks is greater in the lower and upper quantiles than in the middle quantiles.Notable episodes of net receiving correspond to the COVID-19 event (March 2020) in the lower quantile (negative returns) and the end of many COVID-19-related measures (mid-2021) in the upper extreme quantile (positive returns).For some periods, sentiment acted as a net transmitter, including in early 2019, one year after the launch of the ESG Index, just prior to the COVID-19 pandemic when the market was stable, and at the start of the Russia-Ukraine War and its consequences in terms of fossil energy inflation.With respect to Egypt, we note that sentiment assumes the roles of both transmitter and receiver over time.Additionally, a notable episode of net receiving occurred during the COVID-19 crisis in the lower quantile.The transmitter role is assumed primarily in early and late 2019 in the upper quantiles, in early 2021 in the lower quantiles, and in late 2022 in all quantiles.Thus, in general, while sentiment is a net receiver    primarily in the upper or lower extreme quantiles, it acts as a net transmitter under normal market conditions.This implies that Moroccan and Egyptian investors become more sensitive to sustainable investment during distress events, which might lead them to pay more attention to what is being said about sustainable investment.This conclusion contradicts that of Dhasmana et al. [16], who found that investor sentiment does not influence the ESG index in India, indicating that Indian investors are indifferent to the ESG initiatives adopted by companies.

Spillover between investor sentiment and the volatility of ESG indices
Regarding volatility connectedness, we examine market risk at the aggregate level, at different frequencies, and quantiles from both static and dynamic perspectives.Table 2 shows the estimation results for the static connectedness between sentiment, ESG volatility and stock market volatility at the aggregate (panel A), short-term (panel B) and long-term (panel C) levels.The total spillover index calculated using the DY [18] methodology is 34.37% in Morocco and 32.03% in Egypt, confirming that the risk in Morocco is greater than that in Egypt.The total spillover emanates mainly from the long-term spillovers for both markets.In the short-term, the Egyptian market is riskier than the Moroccan market; however, in the long-term, the Moroccan market becomes riskier than the Egyptian market.
In terms of the pairwise connectedness between sentiment and ESG volatility, we notice that at the aggregate level, sentiment explains 0.75% of the forecast error variance of ESG volatility in Morocco; however, the forecast error variance of sentiment explained by ESG volatility is 2.03%.In Egypt, the risk is greater, as sentiment has an impact of 3.31% on ESG volatility, and ESG volatility contributes to sentiment by 1.64%.The significant spillover between sentiment and ESG volatility implies that investor sentiment amplifies risk in these markets.This connectedness is more pronounced in the long term than in the short term.
Nevertheless, the static measure of spillovers assumes that the model coefficients remain unchanged over the entire sample, which fails to capture structural breaks that occur due to extreme events.To overcome this drawback, we re-estimate the spillovers over time.Figure 5 presents the time-varying estimates of the total connectedness index in the time (Fig. 5a, b) and frequency domains (Fig. 5c, d). Figure 5a shows the results for Morocco that suggest that the connectedness among sentiment and volatility varies over time, ranging from 31 to 65%, which denotes a greater sentiment-volatility connectedness compared to sentiment-returns connectedness.Compared to that in the Egyptian market (Fig. 5b), we note that in general, the spillover effect in Egypt is greater than that in Morocco, implying that the former is riskier than the latter.The overall spillover peaks during March 2020, around February 2022, and at the end of 2023 when shocks created a large portion of uncertainty and thus large spillover in the system, which corresponds to the COVID-19 pandemic, the Russia-Ukraine war, and the Israeli-Palestinian conflict, respectively.In these contexts, the shocks in the system created further uncertainty, which was then transmitted across the system.The troughs in spillover during the quiet periods, late 2021 in Morocco and mid-2021 in Egypt, are due to less uncertainty transmission and hence low connectedness, which corresponds to economic recovery from the COVID-19 crisis.This result is in line with that of Liu et al. [40], who demonstrated that exposure to COVID-19 increased market volatility.However, this finding disagrees with those of Albuquerque et al. [1] and Broadstock et al. [10], who suggest that companies with higher ESG scores have less stock price volatility during crisis periods, such as the COVID-19 pandemic.
The total spillover provides aggregate information about how risk varies over time.It does not provide any information on whether shocks that create strong connectedness influence the system in the short or long run.To examine this point, we calculated the spillover effect at different frequencies.In Fig. 5c,d, we note that the total spillover is mainly driven by the long-term spillover.Overall, long-term spillover dominates short-term spillover in both markets.As a result, the shock transmission between sentiment and the volatility of the ESG indices occurs over a longer period, especially in Morocco, where short-term connectedness is low (from 1 to 10%).The most striking observation is that during events with high uncertainty, such as the COVID-19 epidemic and the Russia-Ukraine War, long-term spillover dramatically dominates short-term spillover.This is because investors react very slowly to the arrival of news due to high uncertainty during this period, which results in the shock being transmitted for a longer period and thereby in long-term spillover.This result is in line with Baruník and Křehlík [6].
Examining Fig. 6 related to the net pairwise spillover between sentiment and the ESG indices, we observe a feedback channel between the variables, in which periods when sentiment is a net receiver tend to be followed by periods when it is a net transmitter, with the magnitude of the spillover reaching a high point during specific periods.This finding implies that shocks in ESG index returns lead investors to pay more attention to what is being said about sustainable investment in social media and Internet.This can create shocks in sentiment and therefore attract more investors to invest in sustainable investment, resulting in large movements in the returns on the ESG indices, which is consistent with the finding by Liu et al. [41] that ESG sentiment is positively related to the volatility risk premium.Notable episodes include the COVID-19 crisis, when investor sentiment appears to be a large net transmitter of shocks to the ESG indices, implying that sentiment about sustainable investment makes the returns of the ESG indices more volatile, and in turn, this volatility influences sentiment in subsequent periods.This finding agrees with that of Wan et al. [62], who reported that the degree of focus on ESG has dramatically increased since 2020, which implies that ESG attention has been considerably affected by the epidemic.In addition, we find a high shock transmission from sentiment to volatility on the ESG indices during the first part of 2022, which corresponds to the Russia-Ukraine war and its consequences in terms of inflation.The same pattern can be observed in late 2023, which corresponds to the start of the Israeli-Palestinian conflict.The results imply that during an extreme event, the connectedness between sentiment and the volatility of the ESG indices is strong, and sentiment becomes a net transmitter, which is different from the results obtained when considering ESG index returns, in which sentiment is a net receiver during an extreme event.Indeed, during a crisis period, market returns decrease significantly, creating high uncertainty that transmits shocks to market volatility.As with the total connectedness index, the pairwise spillover is also driven by long-term shocks most of the time (Fig. 6c, d).
To explore how market conditions influence the interdependence between sentiment and volatility on ESG indices, we examine the spillover effect at different quantiles in static and dynamic frameworks.The results for average spillovers at different quantiles are summarized in Table 3.We find that the TCI is greater under extreme market conditions than under normal conditions, while it is greater at the upper tail (95th quantile) than at the lower tail (5th quantile).We also observe that there is a strong feedback channel between sentiment and ESG volatility at the 95th quantile in both markets, ranging from 31.22 to 31.50%.This implies that high ESG volatility creates uncertainty, which can translate into significant fluctuations in market returns.For the dynamic framework, Fig. 7 shows that the total connectedness index is stronger in the upper quantiles than in the other quantiles for both markets.The notable periods correspond to the COVID-19 period in the first part of 2020, the disruptions generated by the Russia-Ukraine war in 2022, and the conflict between Israel and Palestine at the end of 2023.Therefore, periods of crisis lead to high volatility and, ultimately, strong connectedness between sentiment and volatility.Now, we examine the relationship between sentiment and volatility on the ESG indices in different market states.The estimation results, displayed in Fig. 8, show that investor sentiment transmits shocks to the volatility of the ESG indices mainly in the upper quantiles.As with previous results, notable episodes include the COVID-19 epidemic, the Russia-Ukraine war, and the Israeli-Palestinian conflict characterized by uncertainty and hence high volatility.Our results are consistent with those of Naeem et al. [47], who found that investor sentiment acts as a leader of stock market volatility.This implies that sentiment can be used to predict ESG volatility in the Moroccan and Egyptian markets in the upper quantiles and that investors can obtain abnormal returns by using sentiment information to predict markets with high volatility.Therefore, investors should adjust their ESG-based portfolios in a timely manner based on investor sentiment.

Conclusions
This paper investigated the dynamic connectedness between our newly constructed sentiment index and the returns and volatility of the ESG indices in Morocco and Egypt.To this end, we used weekly returns and GARCHbased volatility on the ESG indices from January 2018 to December 2023, as well as the time, frequency and quantile connectedness approaches.The empirical results revealed that the spillover between sentiment and ESG indices varies over time and across countries depending on turbulent events.Furthermore, the results show that sentiment shifts from the net transmitter to the net receiver over time, indicating the feedback channel between investor sentiment and ESG indices, especially during extreme events.Interestingly, the spillover between sentiment and the returns on the ESG indices is mainly driven by the short-term component, except for the COVID-19 epidemic.This can be explained by the fact that during a crisis, shocks translate slowly into ESG returns and have an effect over longer periods due to uncertainty.Moreover, during the COVID-19 epidemic, the spillover effect is stronger in the lower quantile, demonstrating that the crisis generates negative returns, which strongly affects investor sentiment.With respect to volatility, the findings show that, overall, long-term spillover dominates short-term spillover, especially in Morocco.In addition, the connectedness is greater in the upper quantile, indicating that during periods of uncertainty (COVID-19 and geopolitical tensions), market volatility increases, which leads to strong connectedness.Such uncertainty leads sentiment to act as a net transmitter of shocks to volatility in ESG indices.
This study has valuable implications for both investors and policymakers.Indeed, the results provide useful information for socially responsible investors on spillovers between sentiment and the returns and volatility of ESG indices to successfully manage their portfolios.In particular, they allow them to detect under which market conditions sentiment can strongly predict the movements of ESG indices.Furthermore, the results show the possibility for investors to diversify their portfolios geographically (Morocco vs. Egypt) and to adjust their ESG strategy in a timely manner.As far as policymakers are concerned, the findings enable them to achieve the UN goals by attracting more attention to sustainable investment through communication on social networks, for example.The study also has wider international implications, as it highlights the progress made by emerging economies in terms of sustainability, as well as the attention given to sustainability by investors in different regions of the world.
We studied the spillover effect between sentiment and ESG indices in each market separately, but it would be interesting to examine this spillover across different developed and emerging countries.It would also be interesting to analyze the differences between the results of ESG and non-ESG indices.We will consider these issues in future research.

Fig. 1 Fig. 2
Fig. 1 Time-varying total spillovers in the time and frequency domains between sentiment and returns.Note: The blue and green areas represent the short and long term, respectively.The results are based on a VAR model with a 52-week rolling window size and a 100-step-ahead forecast horizon

Fig. 3
Fig. 3 Quantile total connectedness between sentiment and returns.Notes: Warmer shades indicate strong connectedness.The results are based on a QVAR model with a 52-week rolling window size and a 100-step-ahead forecast horizon

Fig. 4
Fig. 4 Quantile net pairwise connectedness (Sentiment-ESG return).Notes: Warmer shades indicate net transmission.The results are based on a QVAR model with a 52-week rolling window size and a 100-step-ahead forecast horizon

( a )
Total spillover in time domain -Morocco (b) Total spillover in time domain -Egypt (c) Dynamic time-frequency total spillover-Morocco (d) Dynamic time-frequency total spillover -Egypt

Fig. 5 Fig. 6
Fig. 5 Time-varying total spillovers in the time and frequency domains between sentiment and volatility.Note: The blue and green areas represent the short and long term, respectively.The results are based on a VAR model with a 52-week rolling window size and a 100-step-ahead forecast horizon

Fig. 7 Fig. 8
Fig. 7 Quantile total connectedness between sentiment and volatility.Notes: Warmer shades indicate strong connectedness.The results are based on a QVAR model with a 52-week rolling window size and a 100-step-ahead forecast horizon

Table 1
Descriptive statistics of the series JB represents the Jarque-Bera test for normality; ADF represents the Augmented Dickey and Fuller Unit Root test; ARCH-LM represents the ARCH Lagrange Multiplier test.Number of observations: 326.(****), (**) and (*) denote significance at the 1%, 5% and 10% significance levels, respectively both markets.Nonetheless, the impact of ESG returns on sentiment is greater in the long term (0.55%) than in the short term (0.26) in Morocco but greater in the short term (1.27%) than in the long term in Egypt (0.72%).These results show that the behavior of Moroccan investors differs from that of Egyptian investors, particularly in terms of the time horizon.This might offer opportunities for arbitrage and diversifications.

Table 2
Averaged spillover results in the time and frequency domains ).The volatility spillovers are in parentheses.The results are expressed as percentages . The volatility spillovers are in parentheses.The results are expressed as percentages