On the Modeling and Simulation of Portfolio Allocation Schemes: an Approach based on Network Community Detection

We present a study on portfolio investments in financial applications. We describe a general modeling and simulation framework and study the impact on the use of different metrics to measure the correlation among assets. In particular, besides the traditional Pearson's correlation, we employ the Detrended Cross-Correlation Analysis (DCCA) and Detrended Partial Cross-Correlation Analysis (DPCCA). Moreover, a novel portfolio allocation scheme is introduced that treats assets as a complex network and uses modularity to detect communities of correlated assets. Weights of the allocation are then distributed among different communities for the sake of diversification. Simulations compare this novel scheme against Critical Line Algorithm (CLA), Inverse Variance Portfolio (IVP), the Hierarchical Risk Parity (HRP). Synthetic times series are generated using the Gaussian model, Geometric Brownian motion, GARCH, ARFIMA and modified ARFIMA models. Results show that the proposed scheme outperforms state of the art approaches in many scenarios. We also validate simulation results via backtesting, whose results confirm the viability of the proposal.

as well as the audience of people interested in investing their money. This new and vibrant scenario fosters novel opportunities and offers elements that suggest revising and improving the techniques to allocate investments on different possible assets and stocks (portfolio management), based on data science and data analysis techniques. This involves three main aspects related to i) the way data traces are analyzed, ii) how the portfolio allocation is performed, iii) which techniques are used to assess whether the portfolio allocation schemes can effectively perform in various scenarios.
As concerns data trace analysis, in the last few years novel metrics have been introduced, that try to better characterize the correlations among different data series, which cannot be considered as produced by stationary processes. These approaches are usually based on detrended fluctuation analyses. In particular, the Detrended Cross Correlation Analysis (DCCA) and Detrended Partial Cross Correlation Analysis (DPCCA) seem to be promising metrics [39,48,21,42,23].
Portfolio allocation is a main research topic, that has been studied in depth in the last decades, especially by the economic and financial community. However, novel studies showed that the contribution of techniques based data and computer science can be quite beneficial. In fact, they promote the design of innovative allocations schemes based on machine learning and data analysis [43,49,35,26,54,28]. For instance, [43] presents a portfolio asset allocation scheme that exploits clustering techniques. Moreover, [28,1] are examples of papers where a deep learning framework is proposed to optimize some portfolios management aspects. Needless to say, due to the novelty of these techniques, there is room for improvement.
In order to foster the design of novel portfolio allocation schemes, there is the need for a framework that allows to effectively study how these devised schemes perform in different scenarios. Indeed, one approach to studying different portfolio allocation strategies is based on backtesting, i.e., taking historical data traces of different asset and stock prices and trying to simulate how the scheme performs over these traces. The principal danger of this common approach is that it can generate statistical overfitting [9]. The computational capabilities of modern computers enable the analysis of thousands of variations of a given strategy, thus allowing to perfectly tune the hyper-parameters of the schemes over such traces. To avoid overfitting, a viable solution consists in performing (Monte-Carlo) simulation analyses. In essence, multiple pseudo-random data trace generation is exploited to study the devised portfolio allocation schemes. Studying the behavior of a scheme over hundreds of (randomly generated) simulation scenarios allows obtaining a wide and general idea about the performance of the scheme in that type of scenario. Backtesting can be finally used as a final test set, to confirm the viability of the devised approach.
In this paper, we try to give a contribution in these three dimensions. In particular, first, we present a Monte Carlo simulation framework, in which different portfolio allocation strategies are compared. Different typologies of data traces are studied to widely assess the schemes. Then, as a further test, we provide results of a more traditional backtest approach. Backtest outcomes confirm the results obtained from simulations.
Second, we implement different variants of the considered schemes, that are based on different metrics used to assess the correlation among data traces, i.e., the traditional Pearson correlation coefficient, DCCA and DPCCA. In particular, we plug these metrics into the allocation schemes, to analyze whether different behaviors are obtained and if some among these metrics perform better than others.
Third, we propose a novel portfolio allocation scheme that resorts to the idea that a group of assets can be treated as a complex network. Thus, we represent the set of assets as a graph and use network modularity to find communities of assets, based on their level of correlation. Weights of the allocation are equally distributed among these communities. While the approach is very simple and naive, results show that in most cases this approach outperforms other well-known strategies. This confirms that the use of complex network theory, and data science techniques in general, are important tools to consider in portfolio analysis applications.
The remainder of this paper is organized as follows. Section 2 provides a general background, needed to easily follow the discussion provided in the rest of the paper. Section 3 introduces the main terminology and notation, as well as the different portfolio allocation schemes that are evaluated in the subsequent sections. Section 4 describes the simulation framework and the evaluation study based on different types of simulation employed to generate the different corpuses of data traces. In this section, we also introduce the metrics employed to evaluate the compared schemes. Section 5 presents and discusses the results obtained using simulation, while Section 6 presents results from a backtest analysis. Section 7 provides a discussion on the results coming from the simulations and backtest, to provide a final overview on the performance of the considered approaches in different scenarios. Finally, Section 8 provides some concluding remarks.

Background
In this section, a general background is introduced. Clearly enough, we cannot cover all the aspects related to modern portfolio theory. The interested reader can find a variety of interesting resources on the topic, e.g., [33,14].

Modern Portfolio Theory
In 1952, Markowitz published a seminal work introducing an investment theory based on mean-variance optimization [33]. Let's assume that you have a certain amount of money to invest; a given set of possible assets, the problem is to find the optimal asset allocation, i.e., how much you are going to invest in each asset. Portfolio allocation schemes cope with this issue, trying to identify the best trade-off between the expected return and risk (measured as the variance of returns). Indeed, some assets might have a high volatility that can result in higher profits, as well as in higher associated risks.
Since the goal is to distribute the allocation of investments into variegated assets, these approaches employ a forecast of the covariance matrix of the expected returns, in order to understand if different assets are correlated or not. Notable risk-based portfolio allocation methods that rely on such covariance forecasts are the minimum variance [11], maximum diversification [10], equal risk budget [8], equal risk contribution [32]. Usually, the covariance of the expected returns are estimated using the covariance of a sample of previous returns.
In Section 3, we will introduce the main notation and go deeper into some details on the specific schemes which are considered in this study.

Detrended Fluctuation Analysis
A main problem here, in the end, is to properly analyze times series related to assets returns. The difficulty is due to the fact that a financial system is a complex system, influenced by a multitude of concurrent and usually unknown factors. Not only, as it happens in many types of other complex systems, e.g., climatology, biology, etc., when we look at many time series, we find that their fluctuations may exhibit crosscorrelation characteristics. As a demonstration, in [39], Stanley et al. revealed the existence of cross-correlation properties among stocks in the Korean market. Moreover, in [48], 48 financial indices were considered and long-range power-law cross-correlations in their returns have been identified.
All this reveals a limitation on the typical use of the traditional Pearson's correlation coefficient on financial data traces, whose use is justified to represent a linear correlation between two time series, which are both assumed to be stationary. To address the drawbacks of Pearson's correlation, the Detrended Cross-Correlation Analysis (DCCA) [21,42] and the Detrended Partial-Cross-Correlation Analysis (DPCCA) have been recently introduced [23]. These approaches are a generalization of the method of Detrended Fluctuation Analysis (DFA) for non-stationary time series [41].

Detrended Cross-Correlation Analysis (DCCA)
The Detrended Cross-Correlation coefficient ρ DCCA (n) is a measure aimed at quantifying the level of crosscorrelation between non-stationary time series {x i }, {y i }. It is defined as the ratio between the detrended covariance function F 2 xy and the detrended variance functions F xx (n), F yy (n) of the two series, i.e.
The value of ρ DCCA (n) 1 ranges between −1 and 1. A value of ρ DCCA (n) = 0 means there is no crosscorrelation, while values −1 or 1 reveal a perfect negative or positive correlation. Such measure can be obtained through the following algorithm [22]: Step I Given the two times series {x i }, {y i }, i = 1, . . . , T , we create two integrated series 1 With some abuse of notation, when possible we omit to specify the names of the time series, thus preferring ρ DCCA (n) to ρ DCCA,xy (n), for the sake of simplicity. with x , y being the mean value of each time series, and k = 1, . . . , T .
Step II Divide {X k }, {Y k } into overlapping boxes of equal length n, being n a parameter to set.
Step III In each box j, a linear fit is performed (by least-squares fit) for each series, here denoted {X k,j }, {Ỹ k,j }. The covariance of the residuals in each box (length n) is Step IV The detrended covariance function F 2 xy (n) is calculated as the mean of the covariance f 2 xy over all the (T − n) boxes Step V Having the values of F 2 xy (n), and being F xx (n) = F 2 xx (n), we can compute ρ DCCA,xy (n) through Equation (1).
As already mentioned, this metrics has been already studied in a wide range of different application scenarios where data series are used [48,42,23,53,27,52] and even in economic contexts [21,22,15]. Thus, it becomes interesting to understand if this is a viable metrics to use in portfolio asset allocation.

Detrended Partial Cross-Correlation Analysis (DPCCA)
Detrended Partial Cross-Correlation Analysis (DPCCA) is an extension of DCCA. Its aim is to combine the advantages of DCCA and partial correlation to further improve the ability to quantify the relation between non-stationary data series. That is, similarly to DCCA, DPCCA should remove the effects of non-stationarity and provide information on the cross-correlation. Moreover, DPCCA should allow investigating the correlations of multiple series in a complex system and find their intrinsic relations [51].
To measure it, given the matrix of DCCA coefficients ρ DCCA (n), we must invert it, obtaining C(n) = ρ −1 DCCA (n). Then, the coefficients of the DPCCA are measured as ρ DPCCA,xy (n) = −C xy (n) C xx (n)C yy (n) being C xy (n) the (x, y)-th element of the matrix C(n).
In the rest of this work, we will exploit these two correlation metrics as an alternative to the classic Pearson's correlation, within the portfolio allocations schemes. An implementation of DCCA and and DPCCA is available in [23,24] 3 The compared schemes In this section, we overview the portfolio allocation schemes that we use in our study. Three of them represent the state of the art of modern portfolio theory, i.e., Critical Line Algorithm (CLA), Inverse Variance Portfolio (IVP) and Hierarchical Risk Parity (HRP). Furthermore, we propose a novel scheme that exploits complex network theory and network modularity as the main elements to categorize and cluster different assets.
All the approaches exploit the standard statistical covariance and correlation as the means to identify those assets that are similar. While this represents a viable and reasonable approach, it forces the analyst to make the (strong) assumption that asset trends are stationary. Moreover, these metrics are tied to the returns time series, not taking into consideration other possible external information that can be easily inferred today, thanks for instance to novel data science and machine learning techniques. Examples go from a simple characterization of assets based on their typology (e.g., hitech companies, banking, healthcare, etc.), to the use of sentiment analysis techniques based, for instance, on the analysis of social networks [13,18]. These considerations suggest that there is room for improvement, in this sense.
Trying to follow this idea, we will consider some variants of the classic approaches. In particular, we plug into the schemes three different correlation metrics, i.e., Pearson's correlation, DCCA and DPCCA, to assess their performance.

Main Terminology and Notation
We consider a generic portfolio composed of N risky assets a = (a 1 , . . . , a N ). The return of an asset a i , at time t is denoted as r t,i 2 . Weights represent the share of wealth invested in assets. We denote with w = (w 1 , . . . , w N ) the vector of weights associated with the set of assets a. Thus, the expected return on the portfolio is w T r.
The N × N covariance matrix of the returns r = (r 1 , . . . , r N ) is denoted by Σ. Given the assets' time series, the covariance matrix is obtained by taking a window of the assets' return time series and by performing the calculation of the covariance in those time intervals. The standard deviation of returns is reported in the main diagonal of the covariance matrix, i.e., σ = diag(Σ). Pearson's correlation matrix can be measured as σ −1 Σσ −1 . Conversely, the DCCA and DPCCA correlation measures are calculated as described in the previous section. Since we are contrasting different measures of correlation, we will refer to Pearson's correlation, DCCA or DPCCA coefficients, depending on the specific variant of the scheme under investigation. In the experimental evaluation, these variants are referred as "cov", "dcca" and "dpcca", respectively.

Critical Line Algorithm (CLA)
The Critical Line Algorithm (CLA) is the one introduced by Markowitz in [33]. It solves a quadratic optimization problem with constraints on each weight [3]. The approach focuses on deriving an efficient portfolio that yields the maximum return for a minimum risk (or volatility). More specifically, the approach tries to solve the following optimization where l i , u i are lower and upper bounds for the weights w i , a constraint is present to ensure that the sum of the weights is equal to 1, and since an objective is to minimize the variance on returns r i , there is an extra constraint with respect to a targeted return r p .
This problem can be turned into a new, unconstrained problem that uses Lagrange multipliers λ and γ, To find a minimum, it is possible to differentiate with respect to all the parameters of the Lagrange function and set the resulting equations equal to zero. This generates a system of (N + 2) linear equations which can be solved to find the resulting w weight vector of allocations.
While the approach is the seminal solution for portfolio allocation, it is recognized that it has some problems related to instability, concentration and underperformance [14]. An open source implementation of this approach is available in [3].

Inverse Variance Portfolio (IVP)
The rationale behind the Inverse Volatility Portfolio (IVP) allocation strategy is, in essence, simple: investments on assets are weighted in proportion to the inverse of the assets' volatilities. Thus, given the standard deviation of returns σ, IVP assigns the following weights to the N assets [46] in matrix form or, alternatively, the weight w i to be assigned to each asset a i is measured as

Hierarchical Risk Parity (HRP)
The Hierarchical risk parity (HRP) is an approach based on the use of graph theory and machine learning to build a diversified portfolio [43]. An overview of the approach is reported in Algorithm 1. The algorithm operates in three stages. The first step uses a hierarchical clustering scheme that clusters similar assets based on their correlation. To perform the clustering, a notion of distance among assets is defined, that is based on their correlation level. In particular, the defined distance be- where ρ ij is the correlation between a i and a j . Based on such distance metrics, near assets are combined into the same clusters.
The second step consists in rearranging rows and columns of the covariance matrix, so as to obtain a quasi-diagonal covariance matrix. The rationale is to have a matrix with high correlations placed close to each other. Quasi-diagonalization ensures that similar investments are grouped together and dissimilar ones are kept fairly apart.
The third step consists in providing weights to assets, which are distributed using an inverse-variance allocation scheme. This is accomplished by recursively bisecting the rearranged covariance matrix. In particular, in the original paper an IVP approach is applied to assets within a cluster, but alternatives are possible [43,31]. An implementation of this scheme is available in [34].

Algorithm 1: HPR Allocation Scheme
Input: corr : Correlation matrix Result: w: allocation weights This approach is a seminal scheme on the use of clustering techniques applied to portfolio allocation. However, some possible limitations have been discussed in the literature. In particular, the use of the "single linkage", as the hierarchical clustering technique, can create a tree of similar assets which might be very deep and wide. This might prevent the creation of dense clusters and affect the weight allocations [40]. Indeed, large weights can be allocated to few assets, with a resulting unequal distribution of the portfolio.

Naive Network Modularity based Allocation (NetMod)
This approach is based on the idea that a set of assets can be considered as a set of entities that share some characteristics and trends. Thus, assets form a complex network where nodes (assets) can be linked together based on their level of similarity. Complex network theory is an area of scientific research that is based on the idea to see everything as a network. This idea is largely inspired by empirical findings that extract meaningful mathematical properties of real-world networks, such as computer networks, IoT and technological systems, social networks, as well as biological and climate ones, gossip and epidemic schemes [5,16,17,37].
In this work, we keep a naive approach based on the correlation matrix, i.e., in the network, nodes are the assets and a link (i, j) exists between nodes i, j if they have a correlation ρ ij > α, where α is a parameter [30].
Given the network, what we do next is to try to identify communities of assets that are similar. To this aim, we apply the Louvain algorithm to measure the network modularity and extract communities of assets [38]. Modularity is a metrics that measures the strength of a division of a network into different clusters (communities). Modularity is usually comprised between −0.5 and 1, i.e., when equal to −0.5, it is not possible to find a good partitioning of the net into communities; when equal to 1, a good partitioning is possible, with dense connections between the nodes within communities but sparse connections between nodes in different communities.
The formula to measure modularity is [5] where A ij represents the link weight between nodes i and j; k i is the weighted degree to node i (same is for j); m is the sum of all of the link weights in the net; c i represents the community of i; δ(x, y) is the Kronecker delta function. The Louvain algorithm operates in a greedy manner, by iteratively repeating two steps [5]. The first step is devoted to find small communities, on a local basis. Thus, it starts with each node that is assigned to a different community. Then, for each node i and each of its neighbours j, it is checked if the overall modularity increases by grouping i and j. In the second step, the identified communities are grouped into a single node to pass through another iteration. After each iteration, the number of thus communities reduces, and the iteration continues until no changes are observed.
In NetMod, once communities of assets have been identified, a simple asset allocation scheme is employed, where the weight to be allocated is equally partitioned for each community, and this amount is once again equally distributed among assets in the community (see Algorithm 2).

Algorithm 2: NetMod Allocation Scheme
Input: corr : Correlation matrix, α: Threshold for link creation Result: w: allocation weights g ← createCorrelationNet(corr, α) partition ← communityLouvain(g) weightPerCluster ← 1/|partition| for clus in partition do for i in clus do w i ← weightPerCluster/|clus| end end return w Clearly enough, this is a simple approach, which has been devised as a basic strategy to understand if the notion of modularity brings some interesting outcomes. We claim that, starting from this proposal, further research might lead to novel optimized portfolio allocation schemes. An open source implementation of the described scheme, in python code, is available in [47].

An evaluation study of different portfolio allocation strategies
In this section, we discuss the main building blocks used to perform the evaluation analysis of the compared portfolio allocation schemes. Thus, we present the types of simulations that allow generating different data traces for assets prices and returns. Then, we discuss the main metrics of interest to assess how the portfolio allocation strategies perform with different types of data traces.

Monte-Carlo simulation framework
To assess all the considered portfolio allocation methods in multiple and heterogeneous situations, different types of simulations have been implemented, that generate synthetic return traces with diverse characteristics. Return r t of an asset at time t is obtained through the price p t of the asset in different moments, i.e. r t = pt−pt−1 pt−1 . Algorithm 3 shows a simplified sketch of the Monte-Carlo simulation to clarify how data are generated and used to assess the portfolio simulation scheme. The parameters that define the simulation environment are the size of the corpus of simulations (numIters, i.e., how many different simulation runs are performed for the considered scenario), the length of the data trace (simLength, i.e., the duration of each simulation run, in terms of number of assets' prices and related returns observations), the size of the time interval after which the weights of the portfolio allocation are tuned and rebalanced based on the return observations (deltaT, i.e., how often the portfolio is updated), the number of assets to be generated (numAssets), the data trace generation type (dataType, i.e., which scheme is employed to generate the data trace), the specific portfolio allocation scheme used to perform the allocation (alloca-tionStrategy). Thus, each simulation run corresponds to a randomly generated instance of occurrences. A data trace is generated using a specific method (see below for those that have been tested during this evaluation). The data trace corresponds to a series of returns for each simulated asset. Then, thanks to the specific portfolio allocation scheme and based on the previous assets' return observations, the simulation computes, on a regular basis (i.e., every deltaT timesteps in Algorithm 3), the weights to be associated with the set of assets. Thus, the weights are used on a period which is different from the one exploited to optimize the strategy (outof-sample). Through the computed weights and the returns of the assets, it is possible to measure the earned portfolio return. During the simulation, all these results are logged to collect final statistics at the end of the execution of the whole corpus.
The implemented types of simulation scenarios are discussed in the following. Figure 1 shows examples of possible sets of generated traces, when the number of synthetic generated assets is equal to 8. The figure should clarify that each simulation type provides a diverse scenario where the portfolio allocation methods are employed and analyzed. This provides a wider and more general understanding of the performances of all these methods, rather than using classic stationary data traces, only.
In the simulation tests discussed in the rest of the paper, the following parameter setting was used. We repeated an amount of 100 simulation runs for each simulation corpus (i.e., each type of simulation). The length of the generated data trace was equal to 520 (equivalent to two years of daily history), while the deltaT parameter was set equal to 60. The number of simulated assets was equal to 32. The window period employed to measure the values of DCCA and DPCCA (i.e., the parameter n in Section 2.2.1) was set equal to 60.

Gaussian Returns simulations
We already mentioned that most studies on portfolio allocation employ the assumption that stationary data series can be used in their analyses [12]. As a matter fact, assets' price time series are commonly non-stationary [53]. Thus, to perform inferential analyses, researchers usually focus on returns on prices, assuming that these can be better approximated via stationary processes. Following this idea, returns are often modeled via Normal distributions [43].
This type of simulation follows such an approach, i.e., assets returns are generated using Gaussian distributions. In particular, x asset returns are generated using independent Guassian distributions. Then, other y asset returns are generated to be dependent on the previous ones. Each of these y dependent traces is generated by randomly taking one of the independent x assets' returns, and adding some white noise, i.e., another (steeper) Gaussian distribution. In Section 5, we will show results from a corpus of simulations where the number of assets was equal to 32, with x = 16, y = 16.
While this represents a standard approach to perform Monte-Carlo simulations in financial applications, it has been shown that financial asset return distributions are usually not Normal [12]. For this reason, other simulation types for the generation of assets returns are considered in the following.

Geometric Brownian motion
The Geometric Brownian Motion (GBM) simulation scheme implements a continuous-time stochastic process, in which the logarithm of the randomly varying quantity of interest follows a Brownian motion with drift [44]. GBM is a popular scheme, that has been used to underlie the dynamics of a diverse set of natural phenomena, including finance, distribution of incomes, body weights, weather forecasts, fragment sizes in rock crushing processes [36]. It is quite useful to model nonstationary random processes. This is obtained by introducing a stochastic drift on the random process.
More in detail, the process is based on a stochastic differential equation where W t is a Wiener process, µ represents the stochastic drift and σ is a measure of the volatility. A Weiner process W t is a stochastic process characterized by these properties: i) W 0 = 0; ii) the increments W t+u −W t , u ≥ 0, are independent random variables; put in other words, the increment from W t to W t+u does not depend on the values of the process before t (W s , s ≤ t); iii) such increments W t+u − W t are Normally distributed with mean 0 and variance u, i.e., W t+u − W t ∼ N (0, u) [25].
The solution to the differential equation above is r t = r 0 e (µ−(σ 2 /2))t+σWt that is the formula used to generate the data traces in these simulations. Also in this case, in Section 5 we will show results from a corpus of simulations where the number of assets was equal to 32, with x = 16, y = 16.

GARCH
The Generalized Auto Regressive Conditional Heteroskedasticity (GARCH) model is a type of Auto Regressive Moving Average (ARMA) model, applied to the variance of the time series. It is composed of an autoregressive term and a moving average term. The rationale around the use of this model in finance is due to the basic observation that, typically, large asset returns tend to be followed by more large returns [6]. Thus, the volatility of asset returns is usually serially correlated. The GARCH(p,q) model is characterized by two parameters p, q. The variance of the time series is characterized as follows In order for σ 2 t > 0, it is assumed that α 0 > 0 and the other coefficients α i , β j are all non-negative. Usually, the GARCH(1,1) model is employed to model the volatility of daily returns, which are in turn calculated based σ t values [6], Here, z t is white noise. Moreover, we should keep α 1 + β 1 < 1 to avoid that the model is unstable.
As per other types of simulation, x traces are created. Then, y traces are generated by randomly taking one of the independent x ones, and adding some white noise based on a Gaussian distribution (in the experiments, Section 5, the amount of traces was x = y = 16).

ARFIMA
The AutoRegressive Fractionally Integrated Moving Average (ARFIMA) process was introduced to generate time series with power-law correlations [19]. It has been recognized that ARFIMA models, when applied to financial time series, sometimes provide significantly better out-of-sample data traces than AR, MA, ARMA, GARCH, and related models [4].
In particular, according to the ARFIMA model each generated variable (asset return) depends not only on its own past, but also on the past values of the other variables. We start by creating pairs of times series r 1 , r 2 with long range cross-correlations [53], ∞ n=1 a n (ρ 2 )r 2,i−n +ε 1,i , where W is a weight value (W ∈ [0.5, 1]) that controls the strength of the correlations between the two traces r 1 and r 2 ; ε 1,i and ε 2,i are independent and identically distributed Gaussian variables with zero mean and unit variance, i.e. N (0, 1), representing white noise; a n (ρ) are statistical weights defined as a n (ρ) = Γ (n − ρ)/(Γ (−ρ)Γ (1 + n)), being Γ the Gamma function; the ρ parameters range in the interval ρ ∈ [−0.5, 0.5].
Following this definition, in this type of simulation, we thus created a set of pairs of x ARFIMA traces (as before, x = 16 in Section 5). Then, an additional set of other correlated traces was created, similarly to the previous case. Thus, other y traces were generated by randomly taking one of the independent x ones, and adding some white noise based on a Gaussian distribution (y = 16, in Section 5).

ARFIMA and correlation with shocks
In this case, we created a combination of traces generated through ARFIMA processes, as described above. After this previous phase, some pairs of asset returns, say a and b, were stochastically modified, in randomly chosen time intervals, by changing their values as follows: r a,i = βr a,i + (1 − β)r b,i , r b,i = βr b,i + (1 − β)r a,i . This was motivated by the idea of adding correlation to certain assets, during limited time intervals. The rationale was to try to understand if sporadic higher correlations are captured by the considered portfolio allocation strategies.
Finally, we added a random amount of shocks to some randomly selected data traces. In particular, we generate a random amount of shocks. For each shock, a random asset a was chosen, as well as a random point in time t i , i.e. the time when the shock started. A random duration of the shock d was generated, comprised in the range [1, T /10] (being T the length of the data trace). For the randomly computed time period [t i , t i+d ], the values of the returns r a,j of asset a at time t j were updated as follows: r a,j = r a,j + α ran(−r max a , r max a ), j = i, . . . , i + d being α a randomly chosen value in [0, 1) set for the whole shock interval, and ran(−r max a , r max a ) a uniformly random generated value in an interval regulated by the highest return for asset a, i.e., r max a .

Backtest
As already mentioned, wide simulation studies are more profitable to study how a given method can perform in general, rather than focusing on some given historical data traces. However, as further validation, some backtests have been performed. In particular, data traces of a two years time interval of a set of assets were collected from Yahoo finance. Then, a backtest simulation was accomplished over these historical data traces.
Indeed, in order to verify how these studied schemes might perform in a real scenario, we took prices of a set of real assets in the period 2019/01/01 -2020/12/31. The rationale behind the choice of these assets was to select them from different sectors, assuming that a certain level of correlation may exist among assets of the same sector. The length of the time series was in line with those generated in the simulation study. Figure 2 shows the related stock prices.

Considered Metrics
In this section, we describe the main metrics used to evaluate the performance of different portfolio allocation schemes. We will report statistical measures related to the returns obtained by applying the different allocation schemes. Moreover, compound log returns are measured, which are obtained by summing log returns. It is a quite commonly exploited measure in finance, since log returns usually show a reduced variation on the time series, thus making it easier to fit the models, when needed. Furthermore, the following metrics have been measured.

Portfolio Variance
Portfolio variance of a portfolio allocation, at time t, is measured as where w t is the vector of weights associated with the set of assets at time t, Σ t is the covariance matrix of returns (at time t), and w T t is the transpose of w t . Higher portfolio variance corresponds to higher risks, and thus it is considered as an indicator of bad performance.

Risk Contribution
The risk contribution of a given asset j to the total portfolio can be measured as where w j is the weight associated with asset a j and (Σw) j is the j-th component of Σw. (Note that for the sake of readability, we removed the time t subscripts.) Risk contribution is the ratio between a weighted average of asset volatility and portfolio volatility. Comparing the assets' risk contribution, obtained through the use of different allocation methods, provides an estimation of portfolio diversification. It is thus interesting to measure the distribution of risks associated with assets, based on their weights.

Diversification Ratio
The Diversification Ratio (DR) of a given portfolio allocation of weights at time t, w t , is computed through the following equation: The diversification ratio is the ratio of the weighted average of volatilities divided by the portfolio volatility (square of the portfolio variance) [10]. It is similar to the risk contribution above, but in this case, it is a global metrics that gives the measure of diversification in the portfolio. A higher diversification ratio is a better performance indicator.

Normalized HHI
Herfindahl-Hirschman Index (HHI) is a common measure of market concentration and is used to determine market competitiveness [7]. It is defined as where N is the number of considered assets. The Herfindahl Index (H) ranges from 1/N to one. Actually, we will consider the Normalized HHI (NHHI), which is measured as The benefit of such normalized version of the index is that it ranges from 0 to 1. Thus, information about the total number of assets (N) is lost, in favor of a more general view of such an index as a measure for the equality of distributions. Indeed, a greater value of the index reflects greater risk concentration, while a small index indicates a competitive market, with no dominant assets. Thus, in our scenario, the lower the better.

Sharpe Ratio
The Sharpe Ratio (SR) is a measure of the expected return of an investment, versus the amount of variability in the return [45]. It is a very popular metrics to wherer is the expected portfolio return, r free the rate you would get from a risk free investment, and σ is the portfolio's standard deviation. Quite often, it is commonly assumed that the risk free rate is zero, thus obtaining SR =r σ . Higher values of SR imply better performance of the portfolio allocation.
The main limitation of this metrics is that the SR value can be accentuated by investments that do not have a normal distribution of returns. Take for instance the case of some investment strategy that usually produces small positive returns with some occasional large negative return. By looking at historical data, one might estimate a large value of the SR, until a big loss takes place.

Value at Risk and Conditional Value at Risk
Value at Risk (VaR) is a measure of the risk of loss for investments. This measure provides a probabilistic estimation of how much a portfolio allocation will lose at worst, given normal market conditions [20]. There are several ways to measure VaR. Here, the calculation of the VaR is performed using historical data. The idea is to construct a distribution of returns based on the empirical distribution of historical returns. Thus, there is an assumption that historical returns represent the distribution of future returns. Then, VaR is measured as the loss value x(t) such that, during the forecast horizon, it is expected that the portfolio will lose less than such x(t) value, with probability (1 − α). That is, given the historical return distribution, VaR is calculated by taking the value that corresponds to the α percentile of such distribution.
Conditional Value at Risk (CVaR) is derived by taking a weighted average of the losses in the tail of the distribution of possible returns, beyond the VaR cutoff point. In practice, the measurement is performed by taking all the historical returns below the VaR, and calculating the mean value.
Being these metrics estimations of loss, the lower the value the better the performance of the portfolio allocation scheme.

Simulation Results
As already mentioned, we consider four allocation schemes, i.e., CLA, IVP, HRP, NetMod. Besides CLA (that is naturally applied using Pearson's correlation), for other schemes we have three variants depending on the correlation metrics that we plugged into the scheme. Thus, in the following, all the approaches are referred to by the identifier of the scheme followed by a label that identifies the correlation metrics, e.g., "NetMod dcca" refers to the NetMod approach when DCCA correlation is exploited.
For each considered scenario, we executed a corpus of 100 simulations. Results are thus average outcomes from these simulation corpuses. We measured the daily returns from the different simulations and performed statistical tests to understand if each scheme is significantly different from the selected baseline approach, i.e., "IVP cov". In particular, pairwise t-tests were conducted, as well as Tukey HSD multiple comparison tests, one for each type of simulation, that consider all the schemes together. While the obtained p-value of the t tests varied, depending on the type of simulation and exploited approach, we never obtained a statistically significant difference (p < 0.05) on such returns, in general. No statistical differences were evident also from the Tukey tests. Nevertheless, in the rest of the section we report the average daily return improvements, as well as the variation of daily returns, since in specific cases we noticed differences worthy of mention. Given the mean daily returnr x of a given scheme x, the improvement was measured as (rx−r baseline ) |r baseline | . Then, we also report the metrics mentioned in the previous section, i.e., Compound Log Returns (CLR), NHHI, Portfolio Variance (PV), Diversification Ratio (DR), as well as the risk contributions and average weights associated with the different assets.
As concerns those approaches exploiting DCCA and DPCCA correlations, for the sake of brevity we omit all the results related to different settings of the box length n, used in Equation (1). In particular, the results reported in this section have been obtained with a value of n = 60, which seemed to be a good compromise in all these different simulation scenarios. Table 1 shows the metrics of interest for the Gaussian returns simulations. According to these simulations, we notice that daily returns (second column of the table) varied similarly for all schemes, showing equal standard deviations, except for CLA that has a higher value. As concerns the average daily improvement, the best result is obtained with "NetMod dcca". An interesting result is related to the NHHI metrics, with "IVP cov" that outperforms other approaches (the lower the better), followed by other IVP, NetMod approaches and "HRP cov". In general, these NHHI values demonstrate that all the approaches equally distribute the weights of the allocations, except for CLA that has a higher value. All the schemes show similar average PVs (the lower the better) DRs (the higher the better), SRs (the higher the better), VaR and CVaR (the lower the better), with worse results for CLA and slightly better results for NetMod approaches.

Gaussian returns simulations
The outcomes outlined in the previous table are confirmed by the next figures. Figure 3 shows the risk contribution distribution on different assets, depending on the employed allocation scheme and correlation metrics. In the chart, assets are ordered according to the measured risk contribution. For each asset, we show the mean value (central dot in the bar), the standard deviation (thicker vertical bar), min and max values (thinner vertical bar). This figure provides a general overview on how each method distributes the risks to different assets. A general outcome is that CLA has a wider variance and under-utilizes the available assets. Among the others, HRP methods tend to have wider variances, followed by NetMod schemes and finally IVP ones. In general, for each allocation scheme we notice that "dcca" and "dpcca" variants tend to have slightly wider standard deviation, than "cov" (probably not visible in the figure). These results are confirmed by Figure 4, where similar statistics are shown on the weight distribution (ordered according to higher to lower weights). Also in this case, it is confirmed that CLA has a wider standard deviation and in general "dcca" and "dpcca" variants have slightly higher values than "cov".
The mentioned results on the volatility of the allocations are confirmed from the average values of the PVs obtained according to the different portfolio allocation methods, which are shown in Figure 5. In this case, it is possible to observe how CLA is worse than other approaches. Table 2 shows the metrics obtained for the Geometric Brownian motion simulations, similarly to what has been done in the previous section. The standard deviation of daily returns slightly varies for all the schemes. NetMod methods seem to be slightly more risky (higher standard deviations, VaR and CVaR), yet offering higher daily returns. Indeed, average PVs are all negligible. While results on the standard deviation penalize Net-Mod schemes, however, these approaches show higher (better) DRs. This result is confirmed from the NHHI measurements, which are lower (better) for NetMod schemes, especially "NetMod cov". NetMod outperforms others also in terms of SR.

Geometric Brownian motion simulations
An interesting outcome is evident from Figures 6-7, where the risk distributions and weight distribution allocations are shown for the different assets (ordered in decreasing order). All the employed methods, except for "NetMod" ones, do not allocate positive weights (and thus no risk) to half of the assets. As mentioned, the assets have been generated to be highly correlated i.e., half of the assets are independent, while others are generated starting with a given randomly chosen asset and by adding some random noise. Thus, these approaches select one among the highly correlated assets ad avoid    the use of the other ones. Conversely, by design the "NetMod" schemes identify such correlation, but then equally distribute the portion of the weights to be allocated to each specific cluster of correlated assets. This results in a more varied use of the considered assets and in a larger (yet limited in value) portfolio variance, as shown in Figure 8. Table 3 shows the performances of different allocation schemes obtained running the GARCH simulations. Net-Mod schemes outperform others, since they offer higher return improvements, lower NHHIs, higher DRs, higher SRs, lower VaR and CVaR values. Other metrics provide comparable results. Again, worst results are those obtained for CLA. This is confirmed by looking at Figures 9-11, showing, respectively the risk contribution distributions, weight distributions and portfolio variances.    pecially the "dcca" and "dpcca" variants. This happens without an increment on the standard deviations of the returns or increments of VaR, CVaR, which are instead lower that those of HRP methods. Figures 12-13 show the distributions of risk contributions and weights allocations. CLA assigns higher risks and weights to some specific assets, with a wide standard deviation. Instead, other approaches distribute risks and weights among multiple (all) assets. In general, a higher distribution is obtained when the "dcca" variants are used. Such approaches also show wider standard deviations w.r.t. "cov" variants, as well as maximum and minimum values. Moreover, HRP methods have higher variances with respect to NetMod and IVP. In any case, the measured PV is limited for all methods (except for CLA), as shown in Figure 14. Table 5 shows results for the simulations where assets returns were generated through ARFIMA processes mixed with some temporal adjustments to further increase correlation, and where some random shocks were introduced. As in other contexts, CLA is the worst method. Among other approaches, it seems that better results are obtained when "cov" schemes are employed in this case. As concerns the returns, NetMod outperforms other approaches.

ARFIMA and correlation with shocks simulations
A comparison between results related to this type of simulation (Table 5) and those obtained for ARFIMA (    Figures 15-17 show the risk contributions, weight allocations and portfolio variance, as for other types simulations. The general trends are confirmed also in this case. We can also appreciate a slight increment in the variability of risk contribution and weight allocations for the "dcca" schemes.

Backtest Results
The outcomes obtained with the previous simulation studies are confirmed when backtests are performed. As shown in Table 6, NetMod schemes perform better than others, since also in this case they show higher daily return improvements, higher CLRs, lower (better) NHHIs, higher (better) DRs, higher (better) SRs. As to VaR and CVar, similar results are obtained for all the schemes, with NetMod slightly worse than others. In these cases, all the values of PV are smaller than 10 −4 . By looking at the improvements on the returns, CLRs and other metrics, it seems that the "dpcca" variants are the best ones.
Risk contributions and weight allocations are reported in Figures 18-19. It is interesting to observe that all approaches tend to assign a high weight to GLD, which is a stable asset. In particular, IVP and HRP assign to GLD a weight significantly higher than other weights. This results in a corresponding higher risk contribution, which can be appreciated especially in "HRP cov". CLA assigns positive weights to a limited amount of assets. As concerns NetMod schemes, in many cases, the community detection algorithm often puts GLD as a singleton asset, different than oth-ers. Thus, "NetMod cov" assigns high weight to GLD w.r.t. others, which are nonetheless not null and higher than in IVP and HRP schemes. In "NetMod cov", this results in a limited risk contribution associated with GLD. This aspect is even more evident in "NetMod dcca", where the weight associated with other assets is higher. As a consequence, the risk contribution of GLD in "NetMod dcca" is minimal. This happens since the "NetMod dcca" variant tends to create smaller communities than the "NetMod cov" approach. Thus, the weights are more distributed among different sets of assets. This outcome is confirmed by the NHHI measures reported in Table 6, where "NetMod dcca" (and "NetMod dpcca", similarly) has a way lower value than other schemes, thus resulting in a more shared allocation and competitive market, with no dominant assets. Table 7 provides a summary of the results, discussed in the previous sections, to facilitate a general overview of the outcomes. In particular, each row of the table shows results related to specific metrics. Results about the returns, shown in the previous tables (i.e., daily ret, Impr) have been aggregated into a single one (Ret). Moreover, PV has been omitted here, since it did not show differences among the approaches in almost all the scenarios, except for CLA, as already discussed in detail. Each column of the table focuses on a specific type of simulation or backtest. For each metrics and each type of simulation (or backtest), the table reports those approaches that showed the best results. In gen-  eral, a specific allocation scheme with the related measure of correlation variant is reported (e.g., NetMod cov) which means that the specific configuration provided the best results. In other cases, only the name of an allocation scheme is shown (e.g., NetMod), meaning that the particular scheme worked better than others regardless of the correlation measure. Similarly, when only the correlation metrics is reported, it means that the best results have been obtained with that specific metrics, regardless of the allocation scheme. Configurations are reported in brackets when some slight, not significant improvements have been noticed. Finally, void cells signify that no particular winner is available for that metrics in that scenario.

Summary of Obtained Results
The decision on which allocation scheme performs better than others should be taken by looking at all the metrics, considered together. All of these metrics focus on a particular aspect of the allocation, and some of them, while extremely popular in the financial analysis sector, received critiques in the literature. For example, SR is one of the most common metrics used to evaluate the performance of investments. However, it has been recognized that SR values are accentuated by investments that do not have a normal distribution of returns, and in general, it is subject to estimation errors that can be substantial in some cases [29]. Similarly, as a further example, VaR is by far another leading measure of portfolio allocation analysis and it is widely used in major banks and financial institutions. But also in this case, this metrics is not exempt from criticism. In particular, it has been recognized that this measure can discourage diversification [2]. Thus, a wider overview of the available metrics should give some insights on the performance of the considered schemes.
The table clearly shows two important results. First, NetMod outperforms other portfolio allocation strategies in all the considered scenarios. In a few cases, other schemes provide better VaR (and CVaR in some cases), but differences are not so important.
Second, it seems that a naive replacement of the classic Pearson's correlation with DCCA or DPCCA does not provide significant benefits in many scenarios. The classic Pearson's correlation performs better than DCCA and DPCCA in various situations, while the latter metrics might perform better when data traces are highly correlated and non stationary (e.g. ARFIMA). Thus, some further investigation might be needed in this sense. Figure 21 shows the networks generated by the NetMod scheme in the backtest, in a specific window of 64 observations. In particular, each reported network depends on the threshold α that is used to create links among nodes in the network (as discussed in Section 3.5) and on the specific correlation metrics in use. Below each network, it is reported the list of communities of assets obtained using the Louvain algorithm to measure the network modularity. Each row shows three different networks when varying α, while keeping the same correlation metrics. Each column shows the networks obtained using the different correlation metrics while keeping fixed the value of α.

NetMod Communities Obtained when Varying Threshold and Correlation Metrics
The figure clarifies two main aspects: i) as expected, the higher the threshold, the less connected the network; ii) the threshold α has a different impact on the    Table 7: Summary of results: best approaches based on specific metrics and simulation typology generation of the networks depending on the used correlation metrics. DPCCA is more threshold sensitive. This suggests that, instead of using a fixed value for α, equal for all the correlation variants as done in this evaluation study, the scheme should be accompanied by preliminary test and validation phases to properly tune the hyper-parameter α. This investigation is left as a future work.

Conclusions
In this work, it has been shown that modeling, simulation and data science techniques can be extremely useful to evaluate complex scenarios and to design novel approaches in financial applications, such as portfolio analysis and allocation. In fact, first, a detailed and variegated simulation framework allows performing what-if analyses and studying if the devised schemes perform well in different situations.
Second, we have shown the feasibility of using alternative measures to describe and characterize data series. Here, we used the notions of DCCA and DPCCA as an alternative to the classic Pearson's correlation measure. In the portfolio allocation approaches, we naively replaced the original correlation with these metrics. While the obtained results do not outperform the classic correlation in many considered scenarios, we showed that a proper tuning of the hyper-parameters employed in the allocation schemes can have a strong influence on the final performance. This tuning should be accomplished through specific data analysis, once a specific correlation metrics is used. The benefits of DCCA and DPCCA on portfolio allocation thus remain an open question. This aspect will be future work. Another point worthy of mention is that a drawback of the Pearson measure is its inability to capture the directionality of the relationships between asset classes. Looking into di-rectionality might be helpful for a better analysis of assets' interdependence and might provide interesting insights. Further research can be devoted to the study of measures to capture directionality and see if they can have some impact on asset community identification.
Third, we described a novel scheme, here called Naive Network Modularity based allocation (NetMod), that takes all the assets and, based on the employed correlation metrics, builds a complex network. Communities of assets are identified thanks to modularity. The approach then distributes investments among such communities. While simple, the approach outperforms the state of the art approaches in many situations. Possible improvements can go in the direction of not equally distributing the weights, but consider, for example, the variance or risk of the communities, with intra and inter-communities optimizations. Further investigation might be on the analysis of alternatives to the exploited Louvain method to detect communities. Examples worth of study are the Walktrap algorithm, Infomap, the Fastgreedy, and the Leading Eigenvalue [50].
All this confirms the benefits of using data science and complex networks theories in portfolio management and financial applications. The obtained results foster the claim that there is room for improvement and thus, further research is needed. On the other hand, such applications can in turn foster novel research in the data and information science theoretical domains, trying to cope with the need to measure financial metrics and to design effective modeling and simulation techniques.

Declarations
S. Ferretti declares that he has no conflict of interest.