Measurement and Control of Risk Contagion in Portfolio Optimization Processes

: The success of an investment portfolio is not only related to its yield, but is also influenced by market risks, especially the contagion risks that may exist between assets. Therefore, effective portfolio optimization requires first studying the risk contagion relationship between financial assets. We selected a total of six financial assets from different stock and exchange rate markets as the research objects, and explored the risk contagion relationships of various assets in the investment portfolio through Vine Copula. Research has shown that there is often a structural mutation in one or some assets of an investment portfolio, leading to significant fluctuations in investment returns. The Vine Copula model can effectively measure the risk contagion between assets caused by asset structural mutations.


Introduction
With the continuous deepening of global economic integration, the free flow of capital, and the existence of multinational financial institutions, the world economy is becoming increasingly interconnected.If a financial market in a certain country or region experiences a risk crisis, other financial markets may be affected by it, and related economic activities may be impacted, which may lead to financial risks [1].The phenomenon of volatility transmission between financial markets has attracted great attention from financial institutions and investors, and it is crucial to reasonably and effectively measure the evolution of this volatility spillover in risk management over time.Markowitz's portfolio theory also indicates that the risks present in investment portfolios are often difficult to avoid.When a certain asset experiences a sudden change, it may cause significant fluctuations in the portfolio assets, leading to risk contagion and increasing the likelihood of risk occurrence [2].
A good investment portfolio aims to achieve the maximum return at a given level of risk, which requires the mathematical modeling of portfolio selection and optimization, taking into account the true characteristics of the assets that make up the portfolio, such as possible correlations, dependencies, market risks, etc. between assets.Studying the dependency relationships between assets in investment portfolios will help us better explain the asset relationships in integrated markets [3].The Markowitz model is the first model to formally analyze asset allocation and selection problems, considering the special case of adjusting risk preference to a quadratic utility function.The analysis of this problem provides all investment portfolios that constitute the "so-called efficient boundary", which represents the best return that can be achieved at each level of risk.Subsequently, Bares et al. used an equal elasticity utility function to discuss portfolio optimization within the framework of the expected utility method [4]; Hunjra et al. constructed the optimal investment portfolio using alternative risk measures [5].Compared with classical analysis results, these methods demonstrate their performance and confirm the possibility of dealing with portfolio selection problems outside of the Gaussian framework.
Previous studies have shown that the asymmetric nature of portfolio dependency structures can be described using copula functions, particularly in the study of asset allocation and risk contagion problems.Chun et al. used a mixed Copula model to study the risk contagion between stock index futures and spot prices [6].Wu et al. used the dynamic Copula method to study the risk contagion changes between the financial markets of China, the United States, Japan, and Hong Kong during the subprime mortgage crisis [7].Mba et al. used the t-copula method to optimize and analyze the risk and return of cryptocurrency investment portfolios within a multi-cycle framework [8].Boako et al. integrated the copula function into the Garch model to analyze the structural interdependence between assets and optimize the value at risk of investment portfolios [9].
It can be seen that Copula, as a multivariate model, has been widely used in the study of risk contagion effects in investment portfolios and has achieved significant results.However, these studies are all based on static Copula models to study investment portfolios, and financial risk contagion is based on binary Copula functions, limited to only two financial time series.The capital market is diversified, and the factors affecting investment portfolios are constantly changing, especially under the influence of external factors such as shocks and economic uncertainty.Therefore, more and more scholars are using dynamic Copula to study the dynamic characteristics of risk contagion relationships in investment portfolios, thereby improving the effectiveness of portfolio optimization research.
Vine Copula can construct multivariate joint distributions with flexible calculations.It not only solves the risk contagion relationship between multiple financial assets, but also allows for different forms of Copula functions to exist between different assets.Therefore, we measure the risk contagion relationship in high-dimensional financial markets by constructing a dynamic R-Vine Copula model, providing new ideas for risk management research in portfolio optimization.

Literature Review
The Copula theory has attracted the attention of risk control departments since its proposal.In 1999, Embrechts officially introduced the Copula method into the field of financial risk management [10].In 2002, Patton applied Copula theory to financial econometric models and achieved good results [11].Next, Nelson summarized Copula theory, constructed Copula functions, and provided a detailed introduction to the properties and application scenarios of Copula [12].In 2011, Shamiri et al. combined two Copula functions to construct a mixed Copula model, which has shown good results in the study of tail correlation [13].Aas et al. constructed a Pair Copula function to reduce the joint distribution of high-dimensional variable data, which effectively solved the error problem caused by excessive dimensionality [14].Czado et al. conducted research and analysis on the interdependence of financial assets based on the D-vine Copula structure [15].
It can be seen that the research on risk contagion using Copula has become relatively mature.The research on Copula models in China was relatively late, but significant progress has been made so far.Zhang introduced Copula theory in easy-to-understand language and conducted in-depth discussions on the feasibility of its application in the field of financial risk analysis, which later became the theoretical basis for Copula's application in China [16].In 2004, J. Zhang conducted a detailed review of the origin and development of Copula theory, collected specific data in the financial field, and discussed the correlation between financial asset variables [17].Wu constructed several general models based on Copula theory, and combined them with specific financial risk analysis cases to clearly introduce the practicality of Copula theory [18].Z.Q.Dong et al. proposed a model that can accurately analyze the tail by analyzing two different types of stock data [19].R.S. Qiao and Y.S. Qiao combined LSTM with Copula for portfolio optimization analysis and risk measurement, theoretically improving the expected return of the portfolio and effectively measuring the risk contagion between assets in the portfolio [20].
The existing literature indicates that, in the process of optimizing asset portfolios, there is often a structural mutation in one or some assets, leading to significant fluctuations in investment returns.The Copula function is widely used in risk management research in financial markets, which well reflects the risk contagion relationship between assets caused by asset structural mutations.

Theoretical Basis
The Copula model is the mainstream method for measuring the risk contagion relationship between capital markets or assets.Nelson formally defined the multivariate normal Copula function [21], and its distribution function and density function expressions are as follows: Among them, is the correlation coefficient matrix with diagonal 1, ∅ ρ is the standard multivariate normal distribution that follows the correlation coefficient matrix, and ∅ −1 represents the inverse function of the standard normal distribution.The multivariate normal Copula function has a symmetric structure and can be used to calculate the linkage effect between different assets, helping investors determine the symmetric risk contagion relationship between assets.However, it cannot effectively describe the tail risk of the capital market.
Among them, ρ refers to the correlation coefficient matrix with diagonal element 1, T ρ,v represents the standard multivariate t-distribution that follows the correlation coefficient matrix ρ with degrees of freedom v, and t −1 v represents the inverse function of the tdistribution with degrees of freedom v : The Student-t Copula model also has a symmetric structure, but the Student-t Copula function has a thicker tail, so the Student-t Copula model can better describe the tail risk between capital markets or assets.
(2) Gumbel Copula function The distribution function C G and density function c G of binary Gumbel Copula can be expressed as: In the formula: αϵ[1, ∞) is the correlation coefficient of Gumbel Copula; at that time α → 1 + , random variables u and v tended to be independent, lim which means that the Gumbel Copula function tends towards the upper bound C + of Fréche, that is, u and v tend to be completely correlated.
The lower tail correlation coefficient of the binary Gumbel Copula is: τ L = 0, and the upper tail correlation coefficient is:

The density function of the Gumbel
Copula has asymmetric characteristics, with a low lower tail and a high upper tail, forming a "J" shape.Therefore, the Gumbel Copula function with upper tail correlation characteristics has a good fitting effect.
(3) Clayton Copula Function The distribution function C C of the binary Clayton Copula.It can be expressed as: In the formula: When α > 0 and φ(0) = ∞, Equation ( 7) can be simplified as: At that time α → 0 + , random variables u and v tended to be independent, i.e., lim which means that the Clayton Copula function tends towards the upper bound C + of Fréche, that is, u and v tend to be completely correlated.
Correspondingly, the density function c C of the Clayton Copula can be expressed as: The lower tail correlation coefficient of the binary Clayton Copula function is: α , and the upper tail correlation coefficient is: τ U = 0.The density function of the Clayton Copula has asymmetric characteristics, with a high lower tail and a low upper tail, forming an "L" shape.Therefore, the Clayton Copula function with lower tail correlation characteristics has a good fitting effect.

(4) Frank Copula Function
The distribution function C F and density function c F of the binary Frank Copula can be expressed as: In the formula: αϵ[−1, 0)∪(0, ∞) is the correlation coefficient of the Clayton Copula.α > 0 indicates that the random variable has a positive correlation and tends to be independent, and α < 0 indicates a negative correlation.
The coefficient of dependence between the lower and upper tails of the binary Frank Copula function is: The Frank Copula's density function has symmetric upper and lower tails, forming a "U" shape.Therefore, the Frank Copula function is suitable for characterizing symmetric financial market characteristics, but cannot capture asymmetric financial market characteristics. (

5) C-Vine Copula Model and D-Vine Copula Model
The Vine Copula model is a further development of the Copula function, which overcomes the deficiency of low market dimensions in risk contagion research and can more effectively depict the risk contagion relationship between high-dimensional capital markets or assets.Among them, the C-Vine Copula and D-Vine Copula, as two special forms of the Vine Copula function, have significant advantages compared to traditional Copula models and have been widely applied.
The joint density function of the C-Vine Copula model is: The joint density function of the D-Vine Copula model is: C-Vine Copula and D-Vine Copula are two special structures in the Vine Copula.When one asset is a key asset that triggers risk contagion in other assets, the C-Vine structure is used to characterize the risk contagion relationship; when there is a relatively independent relationship between assets, the D-Vine structure is used to describe their risk contagion relationship.However, due to various limitations in practical applications, it may lead to the failure of characterizing the contagion relationship between capital markets or asset risks.In view of this, Bedford et al. constructed the R-Vine Copula model to describe the possible risk contagion relationships between high-dimensional capital markets or assets, compared to the star-shaped C-Vine Copula and the parallel-structured D-Vine Copula, the R-Vine Copula has a flexible and variable vine structure, which has better modeling and fitting accuracy and can more flexibly depict complex relationships between highdimensional financial markets or financial assets [22].At the same time, the R-Vine Copula has strong practicality in characterizing the nonlinearity between financial time series.It not only solves the difficulty of estimating multiple parameters simultaneously and simplifies modeling problems but also facilitates more accurate analysis and understanding of related problems.Given the aforementioned excellent properties and advantages, this article intends to comprehensively utilize the R-Vine Copula model for empirical research.

Sample Selection and Model Construction
In order to ensure more comprehensive research results, this chapter selects a total of six financial assets from different stock and exchange rate markets as the research objects.The stock market selects the Shanghai Composite Index (SSEC), the Shanghai and Shenzhen 300 Index (CSI300), and Standard & Poor's 500 Index (S&P500) as the research samples, while the exchange rate market selects the USD-CNY, EUR-CNY, and EUR-USD as the research samples.The sample period selected the daily closing price from 1 January 2020 to 31 December 2022 and used the data from 1 July 2022 to 31 December 2022 as the validation sample.The trading time in each market is not completely consistent.After removing the sample data with inconsistent trading days, 698 sample datasets were ultimately selected.(Data sourced from Wind database.) From the results in Table 1, it can be concluded that the average stock returns among the six financial assets are all positive, and the exchange rate returns reflect a relatively small standard deviation.The stock assets all exhibit obvious left-skewed characteristics, and the kurtosis of all financial assets are greater than 3, indicating that all financial assets exhibit obvious peak characteristics.From the J-B test results, it can be seen that all stock indices significantly rejected the null hypothesis, indicating that the returns of all financial assets do not follow a normal distribution.Overall, the stock market and exchange rate market both exhibit significant typical features such as spikes, thick tails, and autocorrelation, which may affect the accuracy of risk measurement.Therefore, in portfolio optimization research, it is necessary to screen financial assets and select the most suitable ones to construct portfolio investments.
By calculating the total return, total risk, and return-to-risk ratio of six financial assets from 1 January 2020 to 30 June 2022, and combining with the corresponding asset characteristics, investment portfolio optimization research is conducted to construct a more effective and scientific investment portfolio.From the results in Table 2, it can be seen that for the S&P500, with the lowest total risk among the assets, is 0.0452.Although EUR-USD has a relatively small total risk (0.0475), its total return is −0.0182.Therefore, from the perspectives of total return and total risk, EUR-USD can be excluded in portfolio selection.SSEC can also be excluded from the investment portfolio.Therefore, an investment portfolio consisting of four financial assets, CSI300, S&P500, USD-CNY, and EUR-CNY, can be obtained.The instability of financial markets leads to high volatility in returns, and there is a structural mutation in the return of financial assets between different volatility states.For example, asset returns are in a high-volatility state at time t and a low-volatility state at time t + 1, which means that there is a structural mutation in assets between time t and time t + 1.Moreover, when optimizing investment portfolios, the weight coefficients of assets in each investment portfolio change over time.Therefore, time-varying investment portfolio optimization should be based on maximizing investment returns and minimizing relative risks.
In order to better reflect the important impact of structural mutations in portfolio optimization, this paper constructs Mean VaR and Mean CVaR models for portfolio optimization in both static and time-varying states (As shown in Table 3).By analyzing the results of static portfolio optimization, it can be found that the Mean CVaR portfolio optimization model based on structural mutations bears the minimum risk but has the highest return rate, fully demonstrating the superiority of the Mean CVaR portfolio optimization model based on structural mutations.Through analysis of Table 4, it can be found that the risk value of the Mean CVaR portfolio optimization model based on structural mutations is much lower than that of the Mean CVaR and Mean VaR portfolio optimization models, indicating that the portfolio optimization model under structural mutations can significantly reduce investment risk.In terms of investment return rate, the return on investment of the Mean CVaR portfolio optimization model is slightly better than that of the portfolio optimization model based on structural changes, but the difference is not significant, and it is significantly higher than the return on investment of the Mean VaR portfolio optimization model.Taking into account both investment return rate and risk, the Mean CVaR portfolio optimization model based on structural changes has significant advantages and can better achieve portfolio optimization.

Risk Measurement
Traditional risk contagion measurement methods include the VaR and Granger causality tests, which are linear methods and have significant shortcomings.The financial market is a complex nonlinear system, and only nonlinear risk contagion models can truly reflect the risk contagion relationship in the financial market [23].The Copula model, as a representative of nonlinear risk contagion research, is the mainstream method for measuring the risk contagion relationship between financial markets or financial assets.The R-Vine Copula model can high-dimensional and dynamically depict the dynamic risk contagion relationships between different markets or assets.Compared with C-Vine and D-Vine, the construction of R-Vine is more complex, with a total of (n!/2)×2 C 2 n−2 R-Vine structures with n variables and different R-Vine matrices ((n!/2)×2 C 2 n−2 ).Therefore, when there are many variables, the number of R-Vine structures will be large.At this point, the Maximum Spanning Tree (MST) algorithm is needed to determine this number [24].
According to the research findings of Aas et al. [14], multivariate functions are decomposed into a series of Pair Copula density functions and edge density functions in a certain structure.Therefore, the dimensional joint probability density function of R-Vine Copula is: In the formula, f (x i ) is the density function of F(x i In the formula: u is the dimension parameter of Pair Copula, u i representing a component in the dimension vector u, u i−j which is the dimension vector u i obtained by removing i − j from the vector u.
Construct and estimate the R-Vine Copula model based on the aforementioned theory: calculate the Kendall rank correlation coefficient between two variables, apply the AIC criterion to select the optimal Pair Copula function, and use sequential estimation and maximum likelihood estimation methods for the model parameters [26].

Kendall's Tau Rank Correlation Coefficient between Samples
By analyzing the Copula function of each financial asset, the Kendall rank correlation coefficient between pairwise samples can be obtained [27].The Kendall-τ rank correlation coefficient has the excellent property of not changing the coefficient after monotonic transformation, and the specific results are shown in Table 5.According to the research results in Table 5, it can be seen that the likelihood of risk contagion between the US stock market and the Chinese stock market is lower than that between other financial markets.The reason may be that the regulatory systems of the financial markets in China and the United States are different, and the circulation and exchange between the two markets are relatively low, resulting in a lower possibility of risk contagion.

Research on Risk Contagion Measurement Based on R-Vine Copula Model
In order to investigate the fitting effect of the R-Vine Copula model on the correlation of highly dimensional financial markets, this paper constructs the R-Vine Copula model to describe the risk contagion relationship between highly dimensional financial markets or financial assets.
From the research results in Table 6, it can be concluded that the risk contagion values between all financial assets are positive, and the risk contagion relationships between the return sequences of each financial asset in the first layer tree structure are mainly characterized by the Student Copula function.The risk contagion relationship values are all greater than 0.25, indicating a strong positive risk contagion relationship between the return sequences of each financial asset.
However, in the second layer tree structure, the risk contagion coefficient of 4,6|5, i.e., USD-CNY and EUR-CNY under EUR-USD, is 0.3568, indicating a strong risk contagion relationship between the RMB exchange rate and the euro and US dollars under the influence of the euro-to-US dollar exchange rate.In the third layer of the tree structure, it can be seen that the risk contagion coefficient of the domestic financial market is higher under the influence of the exchange rate market, while under the influence of the complete exchange rate market, the risk contagion coefficient between financial assets is greater, indicating that fluctuations in the exchange rate market can better induce the occurrence of risk contagion effects.Furthermore, according to the tree structure analysis in Table 6, the R-Vine Copula model is based on the maximum sum of absolute values of correlation coefficients in each layer, selecting the optimal tree structure that can characterize the risk contagion relationship between financial assets.
Different Vine Copula models have different vine structures, ultimately affecting the accuracy of risk contagion characterization between financial assets [28].In order to more intuitively reflect the accuracy and superiority of the R-Vine Copula model in characterizing the risk contagion relationship of financial assets, it was compared with the C-Vine Copula and D-Vine Copula models by using the maximum likelihood value LL, The AIC and BIC criteria are used to test the reliability of three different Vine Copula models in fitting asset risk contagion relationships.Then, the likelihood ratio-based test method proposed by Vuong is used to further verify the fitting effect of the models [29].According to the analysis of Table 7, it can be concluded that the R-Vine Copula model has the maximum likelihood value, indicating that it has better fitting performance and can better demonstrate the risk contagion relationship between financial assets [30].Meanwhile, the likelihood value under the D-Vine structure (parallel structure) is closer to the likelihood value under the R-Vine structure compared to the C-Vine structure (star structure), indicating that the risk contagion relationship between financial assets is also closer to the parallel structure rather than the star structure [31].Furthermore, based on the Vuong test results, it can be concluded that the R-Vine Copula model has better fitting ability.

Investment Portfolio Optimization Results under Risk Contagion
In the context of potential risk contagion relationships between assets, the selection of investment portfolio assets becomes the key factor affecting the success or failure of optimizing investment portfolios [32].For the six financial assets involved in this article, the total return, total risk, and return-risk ratio of each financial asset during the period from 1 July 2022 to 31 December 2022 are calculated to make judgments.Combined with the research results of risk contagion between financial assets, portfolio selection research is conducted to make the constructed portfolio investment prediction more effective and scientific, truly achieving portfolio optimization under structural changes.
From the results in Table 8, it can be seen that between 1 July 2022 and 31 December 2022, EUR-USD had the lowest total risk, while S&P500 had the highest total risk.Therefore, S&P500 can be screened out from portfolio investments.Although the total risk value of SSEC is less than S&P500, due to the strong risk contagion relationship between SSEC and CSI300, risk contagion is more likely to occur in the same portfolio investment.Therefore, based on the perspective of risk contagion, SSEC is excluded in portfolio selection.Secondly, in terms of total returns, the S&P500 has a negative total return during this period, which should be excluded when constructing portfolio investments.Meanwhile, from the results of the return to risk ratio, it can be seen that the financial asset EUR-CNY has relatively low return risk and can therefore have a smaller weight in portfolio selection.Using the method from the previous section, this paper constructs a static portfolio optimization model based on Mean CVaR under risk contagion, and compares and analyzes the performance of static portfolio optimization models based on Mean VaR and Mean CVaR.(As shown in Table 9).By comparing and analyzing the optimization results of three static investment portfolios, it can be seen that the risk values under the three static investment portfolio optimization models show a decreasing state, and the Mean-CVaR based investment portfolio optimization model measures the minimum risk value under risk contagion.This indicates that constructing an investment portfolio model with risk minimization as the goal can effectively achieve the optimization goal while considering the impact of risk contagion between assets [33,34].Meanwhile, in terms of return rate, the investment return rate based on the Mean CVaR portfolio optimization model under risk contagion is significantly higher than the other two portfolio optimization models.Therefore, the risk contagion-based investment portfolio optimization model constructed by combining the two indicators of risk and return can achieve the goal of optimizing investment portfolios.
By analyzing the research results in Table 10, it can be found that, Mean VaR, Mean CVaR, and time-varying portfolio optimization models based on Mean CVaR under risk contagion show a significant decrease in measured risk values, indicating that the Mean CVaR portfolio optimization model under risk contagion has the best optimization effect among time-varying portfolio optimization models based on risk minimization.In addition, in terms of investment return, the investment return of the time-varying portfolio optimization model based on risk contagion is significantly higher than that based on Mean VaR The investment return rate of Mean-CVaR time-varying portfolio optimization model.Therefore, from the perspective of investors, the Mean-CVaR time-varying portfolio optimization model based on risk contagion has better operability and practical value and can better achieve portfolio optimization [35,36].

Conclusions
Empirical analysis was conducted on portfolio optimization under risk contagion based on the R-Vine Copula model.The R-Vine Copula model can high-dimensional and dynamically depict the dynamic risk contagion relationships between different markets or assets.In the initial stage of portfolio construction, it ensures that the portfolio is composed of high return and low risk assets [37].The model can help investors achieve significant cumulative returns and risk adjusted returns in most periods.Select assets with higher returns in the capital market, and then apply the R-Vine Copula model to reduce risk levels and determine the optimal asset to ensure investment safety and profitability.This method can systematically assist investors in making investment decisions, telling portfolio managers which assets to hold and how much to invest in each asset to achieve the goal of obtaining maximum potential return with minimal risk [38].
Subsequent research should be based on broader and more representative research periods and capital market samples, using scientific and reasonable econometric methods such as Copula functions to comprehensively and systematically analyze investment and risk contagion, and consider the impact of external factors on investment portfolios.Especially in the context of China's capital markets opening up to the outside world and the increasing level of financial innovation, in order to better prevent and respond to the huge impact and impact of systemic risks in the international capital market on the Chinese market, in-depth research on portfolio characteristics, and exploration of the specific effects and impacts of portfolio risk management and other factors on them will be the focus of future investors, experts, scholars, and regulatory agencies to improve risk warning levels [39,40].Therefore, starting from the reality of investment practice, exploring how to find the optimal solution between maximizing returns and minimizing risks, achieving the dual goals of high returns and low risks, and constructing a new and effective time-varying investment portfolio optimization model to measure risks has become a major topic in current investment portfolio optimization research.

( 1 )
Student-t Copula functionThe expression for the distribution function and density function of the Student-t Copula function is: represents the dimension of variables, j(k) and h(k) represent node identification.k = {j, h} is the edge between nodes in the Vine Copula tree structure, D(k) is the set of variables contained in the edge k, c j(k),h(k)|D(k) represents the binary Copula function that characterizes the edge{j, h}, and x D represents the sub vectors x contained in D. Each Pair Copula function contains a pair of conditional distribution functions F(x|y) [25], as shown in Equation (15):

Table 1 .
Descriptive statistics of sample asset returns.

Table 2 .
Asset Returns and Risks.

Table 3 .
Optimization Results of Static Investment Portfolio.

Table 4 .
Optimization results of time-varying investment portfolio.

Table 5 .
Kendall's tau rank correlation coefficients between samples based on the multivariate Copula model.

Table 6 .
Parameter estimation results of R-Vine Copula tree structure.

Table 7 .
Fitting descriptions under three Vine Copula models.

Table 8 .
Return and Risk of Assets (Verification Set).

Table 10 .
Optimization results of time-varying investment portfolio (validation set).