Entropy of Financial Time Series Due to the Shock of War

The concept of entropy is not uniquely relevant to the statistical mechanics but, among others, it can play pivotal role in the analysis of a time series, particularly the stock market data. In this area, sudden events are especially interesting as they describe abrupt data changes with potentially long-lasting effects. Here, we investigate the impact of such events on the entropy of financial time series. As a case study, we assume data of the Polish stock market, in the context of its main cumulative index, and discuss it for the finite time periods before and after outbreak of the 2022 Russian invasion of Ukraine. This analysis allows us to validate the entropy-based methodology in assessing changes in the market volatility, as driven by the extreme external factors. We show that some qualitative features of such market variations can be well captured in terms of the entropy. In particular, the discussed measure appears to highlight differences between data of the two considered timeframes in agreement with the character of their empirical distributions, which is not always the case in terms of the conventional standard deviation. Moreover, the entropy of cumulative index averages, qualitatively, the entropies of composing assets, suggesting capability for describing interdependencies between them. The entropy is also found to exhibit signatures of the upcoming extreme events. To this end, the role of recent war in shaping the current economic situation is briefly discussed.


Introduction
In general, sudden or extreme events translate to the atypical patterns and deviations from the expected observations. As such, the ability to detect and address accordingly aforesaid anomalies is of great importance in various areas of science, technology, or even social studies [1][2][3][4][5]. This is to say, timing and occurrence of sudden events is essential when considering reliability of a system under extreme external conditions. A special attention to these aspects is given in the field of economy, where sudden events correspond to a notable incline/decline in economic activity or may even mark a breakdown of some economic models, e.g., by exposing their limitations in terms of efficiency and rationality of the market [6]. In what follows, it is crucial to account for such events during economic modeling when considering processes such as the forecasting, decision making, or anomaly detection [7]. This is conventionally carried out on the grounds of the time series analysis, a vital part of data science [8]. The main reason for that is related to character of the time series itself, which are derived from the financial data and intrinsically encode information about economic events [9]. Thus, to allow discussion of the extreme changes in economy, appropriate tools in the time series domain are required.
In the context of the above, entropy appears as an intriguing analytical concept, which spans beyond its original field of thermodynamics. While in terms of the statistical mechanics, this property relates to the discrete probabilities of microstates, in the area of time series entropy, it is considered as an extension of the information theory [10][11][12][13], in accordance with the groundbreaking works by Shannon and Kolmogorov [14,15]. In particular, entropy can quantify the uncertainty, disorder, or simply randomness of the time series, without adding constraints on the corresponding probability distribution [13,[16][17][18]. Hence, it constitutes an attractive alternative to the standard deviation for measuring market volatility [19,20]. However, entropy allows for discussing not only the magnitude of such fluctuations but also their distributions and patterns [21,22]. It can account for the nonlinearities and correlations in the datasets, simultaneously capturing interdependence between assets [23][24][25]. Moreover, since volatility relates to the degree of an asset movement over time, the corresponding entropy should be inherently sensitive to the sudden events or the economic shocks of interest. As a result, entropy constitutes potentially highly relevant framework for discussing impact of sudden events on the market and a pivotal tool in econophysics [10,12,13,18,26].
So far, the studies on the economic sudden events in terms of entropy have been limited mainly to a few instances, such as the investigations related to the 2008 economic crisis [27] or to the outbreak of the COVID-19 pandemic [11]. However, recent Russian invasion of Ukraine resulted in a yet another prominent economic shock, which is well defined in terms of the timeframes, and influences multiple market branches [28]. The economic consequences of this event constitute not only a perfect platform to investigate the impact of the shock of war on the modern economy but also to validate the entropic methodology in assessing market changes due to the extreme external factors. These arguments, along with the aforementioned general characteristics of entropy in the field of econophysics, constitute intriguing motivation to analyze this new measure in terms of the market volatility description and the resulting potential for the detection of sudden events. Herein, we provide our contribution to this still not fully explored area. In detail, we concentrate our study on the behavior of the main cumulative index of the Polish stock market (WIG20) and conduct our calculations with respect to the conventional Shannon entropy. The WIG20 index was chosen due to the direct proximity of the corresponding market to the theater of war as well as the relatively high development of the Polish economy. For convenience, the obtained results are compared with the predictions of the standard deviation. This analysis allows us to verify efficiency and predictive capabilities of the entropy-based formalism and to outline pertinent perspectives for the future research. It also provides the possibility to give preliminary insights into the other factors potentially influencing the WIG20 index, besides the pivotal shock of war.

Methodology
The present analysis is conducted for the time series of the daily log-returns, as calculated based on the financial data of interest. In particular, the daily log-returns (R i ) are derived by following the relation: where P i (P i−1 ) is the closing price of an asset on day i (i − 1). In this manner, we obtain convenient time series data which are additive and symmetric in accordance with the scope of the present analysis. While the former property simply means that the log-returns are additive over time, the second one is much less self-explanatory. In brief, the symmetry of log-returns relates to the fact that positive and negative log-returns of equal magnitude are equidistant from zero on the logarithmic scale, yielding no net change when compared.
The volatility of the above time series is explored based on the two measures, namely, the standard deviation and the entropy. The former parameter is given by: for the N data points and µ being the arithmetic mean of all the returns. On the other hand, the latter measure is calculated based on the Shannon entropy [14]: In Equation (3), M stands for the number of bins (known also as the intervals or classes [29]) in the discrete probability density function of the returns and p i is the probability related to a given bin. Herein, p i is calculated by employing the Riemann approximation as follows: where x i (x i+1 ) is the left (right) width endpoint of a bin and f (x i+1 ) denotes the corresponding height. Note that, in Equation (3), when the logarithm base is e, the entropy is measured in nats. One can also use base equal to 2 or 10, resulting in the units of shannons or hartleys, respectively. Obviously, the change of units does not influence the qualitative behavior of entropy.
In the present study, the above theoretical model is fed with the financial data of the WIG20 cumulative index and its composing stocks, as divided into two one-yearlong datasets. The first set corresponds to the one-year timeframe before the invasion (24 February 2021-23 February 2022), whereas the second considers a similar period but after the beginning of the invasion (24 February 2022-23 February 2023). In the following, we arrive with the total of N = 251 data points for each set, providing sufficient economic perspective for our calculations. Note that the WIG20 index serves here as a pivotal parameter for comparison between the two approaches in modeling volatility. However, due to its cumulative character, this index measures only the total fluctuations, and to gain better insight into the underlying correlations of the market, the composing stocks are discussed. All of these stocks, including the WIG20 index, are listed in Table A1 along with their full names, market symbols, and the basic summary statistics in Appendix A. This list is valid for the assumed-here time period but it is obviously subject to changes in the future. For the sake of completeness, it is also crucial to note that the component company Pepco was introduced to the stock market on 26 May 2021, i.e., the corresponding records do not cover the entire one-year period before the invasion. In addition, the composition of the WIG20 index changed four times over the analyzed timeframe of two years. In detail, on 18 March 2022, the already-mentioned Pepco and other company named mBank replaced previously indexed stocks of Tauron and Mercator, respectively. Similarly, on 16 September 2022, the company Kȩty replaced Lotos, and on 16 December 2022, Kurk switched with the PGING. All the described changes are appropriately marked in the Section 3 and in Appendix A.
To this end, for the purpose of the present study, both the datasets of interest are divided into the finite number of bins, which compose the discrete probability density function of the returns. There is no general and valid rule that determines the number and character of such bins [29]. The final choice is always strongly related to the population of data points and their variability. In general, one should never stay with the empty bins or decrease their number to the point that resolution of the probability distribution is too low. In reference to the multiple models for the bin number, we observe that M = 20 is optimal for our case. In the first place, the chosen M value provides relatively high resolution of the probability distribution on equal footing across all considered time series, allowing us to not hinder information about the tails in some of the instances. Secondly, the assumed number of bins does not simultaneously exceed the upper theoretical limits for N ∼ 250, as set by the Velleman formula [29].

Results
In Figure 1, we depict standard deviation as calculated for the WIG20 index and its composing stocks. According to the initial assumptions, the results are presented here for the one-year timeframe before (orange) and after (blue) the beginning of the invasion. Note that Figure 1 is divided into three panels: the first for the constant component companies, whereas the second (third) panel corresponds to the stocks, which at some point were introduced to (removed from) the WIG20 index. For convenience, the corresponding numerical results and the percentage difference between estimates obtained for the two considered timeframes are given in Table A2 in Appendix A. Upon the analysis of Figure 1, the total standard deviation appears to be higher after the beginning of the invasion than for the time period before it. This means that the volatility of the market visibly increases for the former dataset. In other words, this indicates higher degree of stock price variations in the second considered period, which can be caused by not only the decline but also incline of the asset value. Similar behavior can be observed for most of the composing stocks. In detail, one can notice that only companies such as Kruk (debt management and purchase), Mercator (medical devices), and CD Projekt (video game developer and publisher) do not comply with this trend. The first company shows practically indistinguishable values for the two considered datasets, while the two latter ones present inverse behavior in comparison to the total standard deviation. The observed standard deviation for the first two companies is potentially related to the fact that their stocks were not included in the WIG20 index for the entire time, meaning their impact on the total index was limited. Moreover, Mercator capitalization, as a producer of medical gloves, was heavily reduced by the end of the COVID-19 pandemic. Finally, the value of CD Projekt was subject to turbulence due to the mixed reviews of their flagship video game product Cyberpunk 2077. Thus, the standard deviation for each of the three companies is the results of not only the wartime market changes but also other, external factors. Despite these deviations, it can be stated that most of the composing assets as well as the cumulative results highlight the impact of the shock of war.
Nonetheless, the results for the individual stocks still allow us to observe that the largest volatility increase is present for the bank sector, with other notable examples in petroleum and telecommunication sectors (see Table A2 in Appendix A for details). Interestingly, by comparing the component estimates with the results for the cumulative index, we can note that the total standard deviation measure does not average values obtained for the individual stocks. In fact, this measure is always lower than any of the corresponding component values. This is true for both considered sets of data and can originate from the way that the cumulative index is calculated or potentially from the shortcomings of the standard deviation approach.
To investigate more in detail the already observed trends, in Figures 2 and 3 we present the discrete probability density function of the returns for the total index and its composing stocks, respectively. Note that these are the empirical distributions of the pooled returns. All the distributions are given for the time period before and after the beginning of the invasion, with the same color scheme as before. Based on Figure 2, it can be observed that the probability distributions for the WIG20 index resemble normal distribution. However, the wartime dataset is characterized by the fatter tails and lower central maxima than the distribution corresponding to the index values before the conflict outbreak. This observation is in qualitative agreement with the results obtained within the standard deviation approach, which suggest higher volatility of the market after the beginning of the invasion. The situation is once again similar when inspecting return distributions for the component stocks, i.e., volatility for most of the stocks is higher after the beginning of the Russian invasion. Still, there is some visible exception from this trend in terms of Pepco data. This is potentially due to the fact that, as mentioned earlier, data for Pepco do not cover the entire year before the invasion because of its relatively late introduction to the market on 26 May 2021.    It is next instructive to compare all the above results with the predictions of the entropic model. These are presented in Figure 4, in the form of the entropy estimates for the WIG20 index and its component stocks, based on the two types of the datasets of interest. In general, the total entropy, as well as the relative behavior, between composing entropies is similar to the standard deviation predictions. However, closer inspection of the results allows us to observe that, contrary to the previous case, here, all the component stocks exhibit higher entropy after the war outbreak. The only exception is Mercator, relatively late in the WIG20 index and experiencing the COVID-19-related problems during the entire analyzed period, as described before. Moreover, this time, the results for the total index qualitatively average results for the component companies. The mentioned observation is particularly visible for the data corresponding to the timeframe after the beginning of the invasion. The results allow us also to note that the percentage difference between the results before and after invasion is smaller for each of the calculated entropies than in the case of the standard deviation results (see Table A2 in Appendix A for details). Finally, the obtained entropies appear to follow the character of the discrete probability density function in Figures 2 and 3, in terms of the differences between results obtained for the two considered timeframes.  To supplement our analysis, we additionally plot the entropic index of WIG20 index for various time periods within the here-assumed timeframes. In Figure 5, we present the obtained results for the datasets before (left panel) and after (right panel) the beginning of the considered conflict. Both panels depict different behavior, namely, before the invasion, the entropic index clearly increases when the assumed time distance from the invasion date becomes smaller. On the other hand, the entropy is relatively stable throughout the entire period after the invasion data, independent of the number of considered days.

Conclusions
In the present study, we validated the entropy-based theoretical framework in describing behavior of financial time series under the influence of sudden and extreme external events. This was carried out in the context of the WIG20 main cumulative index of the Polish stock market for a one-year-long data samples before and after the Russian invasion of Ukraine, respectively. In particular, it was shown that entropy reproduces some of the features of the standard deviation when describing the effects of the shock of war. The obtained results confirmed that entropy can indeed be used as an alternative measure of volatility. These findings not only agree with the previous studies on applications of entropy in finances [10,11,18,24,27], but also supplement them by considering the wartime-driven changes in the stock market. For convenience, all the numerical results are summarized in Table A2 in Appendix A.
In addition to the above, the present study reveled several noteworthy differences between entropy and standard deviation measures. First, the entropy was found to capture the character of empirical data in qualitative agreement with the discrete probability distribution function, which was not always the case when considering the standard deviation measure. As a result, it is concluded that the entropy was better in highlighting differences between results obtained for the two timeframes of interest. This was particularly visible in the case of CD Projekt data, where standard deviation predicted inverse behavior to the probability distribution function and entropy. Finally, it was also revealed that the entropy of cumulative index qualitatively averages entropies of the composing stocks, again in contrast to the standard deviation estimates. This finding is particularly interesting since it shows that entropy holds potential in encompassing interdependencies between assets.
The last part of the analysis revealed that the entropy measure can be used to quantify anomalies in time series toward their better detection. In particular, entropy exhibits different functional character when considering it for various time periods, before and after the beginning of the invasion. In other words, it can be argued that entropy shows signatures of the upcoming economic shock. That means that the impact of a potential sudden event can be visible in the entropy behavior when the time range is sufficiently small and the context data are available for a long time range. In the future, entropy may constitute a building block for future tools aimed at sudden (extreme) event prediction. Interestingly, these results also clearly indicate that the shock of war has a long-lasting effect of increased volatility of the market, at least within the one-year time perspective. To further verify the presented observations, we note that the analysis can be extended toward other more complex or larger datasets and be conducted via more sophisticated entropic models based not only on the Shannon entropy but also on other formulations, e.g., by Rényi [30] or Tsallis [31].
To this end, all the obtained results allow us to make some preliminary statements on the role of invasion in shaping the current economic situation in Poland. The calculated standard deviation and entropy measures clearly point out that the volatility of the Polish market is higher after the crisis outbreak than before. That is to say, the presented study allows us to conclude that the shock of war visibly impacts the Polish economy, according to the fact that the entire analysis was conducted with respect to this well-defined point in time. However, it is difficult to judge how big this impact is in comparison to other factors, such as the still-persisting effects of the COVID-19 pandemic or the internal economic decisions of the Polish government and related financial institutions e.g., in terms of changes in the interest rates of the National Bank of Poland [32]. To address the impact of an additional factors, besides the considered shock of war, extended investigations spanning beyond the scope of the present analysis are required. This can be carried out by identifying the aspects of influence and then by analyzing them separately, but on the same footing, within the economic model of choice. However, due to the potential complexity of the problem, it is argued here that the proposed analysis should incorporate a more sophisticated approach based, for example, on the network and behavioral modeling, in agreement with the recent insights from the field of complex systems [33]. Since similar observations can be made at the level of the European or even global market, it is expected that our entropic approach may provide interesting results with the dependence on the proximity to the conflict zone or the bond strength with the Ukrainian or Russian market. Still, such analysis will be limited in terms of influencing factors, and the above complex approach is expected to be also valuable for such large-scale simulations. In summary, the shock of war appears to be an important factor of recent economic turmoil, but its magnitude in the context of other factors is yet to be determined.

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

Appendix A. Summary Statistics
The current Appendix section contains supplementary data to the discussion presented in the main text.
In Figure A1, the daily log-returns for the WIG20 cumulative index are depicted. The left panel presents data before the conflict outbreak (blue), whereas the right panel depicts data after the beginning of the invasion (orange). The inset presents a more detailed view in the vicinity of the initial invasion day. Qualitatively similar behavior can be observed for each of the WIG20 composing assets.  Figure A1. The daily log-returns for the WIG20 cumulative index before (blue) and after (orange) the beginning of the 2022 Russian invasion of Ukraine. For convenience, the inset presents data in the vicinity of the initial invasion day.
In Table A1, the basic summary statistics of the daily log-returns are given for the WIG20 cumulative index and its composing assets. The data are provided for two considered timeframes, i.e., one year before the invasion day and one year after this date. In Table A2, the numerical values of the calculated standard deviation and entropy, as obtained within the presented analysis, are collected. The data are given in a similar fashion as in Table A1. Table A1. The summary statistics of the daily log-returns before (outside the brackets) and after (inside the brackets) the outbreak of the 2022 Russian invasion of Ukraine. The cumulative index data are followed by the first group for the constant component companies and then by the second (third) group for the stocks introduced to (removed from) the index at some point. The dates of the introduction/removal of the composing companies are given next to the name of the corresponding company.  Table A2. The numerical values of the standard deviation and entropy, as calculated for the WIG20 index and its composing stocks. Similarly to Table A1, the cumulative index data are followed by the first group for the constant component companies and then by the second (third) group for the stocks introduced to (removed from) the index at some point. The dates of the introduction/removal of the composing companies are given next to the name of the corresponding company. The results are presented for the one-year time period before the beginning of the Russian invasion of Ukraine and after this event. For convenience, the percentage difference between estimates obtained for the two timeframes of interest is given for the standard deviation and entropy.