Post on 17-Aug-2015
transcript
Portfolio Risk Analysis
FI6012: Assignment
Barry Sheehan
MSc. in Computational Finance
2015
1 | P a g e
Portfolio Risk Analysis
Title Page
University: University of Limerick
Program: MSc. in Computational Finance
Year of Submission: 2015
Author: Barry Sheehan
Student Number: 0854867
Title: Portfolio Risk Analysis
Word count:
Lecturer: Orla McCullagh
This assignment is solely the work of the author and submitted in partial fulfilment of the
requirements of the MSc. in Computational Finance.
XBarry Sheehan
MSc. in Computational Finance Candidate
2 | P a g e
Portfolio Risk Analysis
Table of Contents
Title Page ................................................................................................................................... 1
1.1 Introduction .......................................................................................................................... 3
1.2 Research Aims and Hypotheses ....................................................................................... 3
1.3 Hang Seng Index .............................................................................................................. 4
1.4 Minimum Variance Portfolio ........................................................................................... 4
2.1 Preliminary Testing of Returns ............................................................................................ 6
2.2 Descriptive Statistics ........................................................................................................ 6
2.3 Normality of Returns ........................................................................................................ 7
2.4 Autocorrelation of Returns and Stationarity .................................................................... 8
3.1 Value-at-Risk and ETL Models ......................................................................................... 10
3.2 Parametric Normal Linear VaR...................................................................................... 10
3.3 Student-T Linear VaR .................................................................................................... 11
3.4 Generalised Pareto Distribution VaR ............................................................................. 11
3.5 Back-testing over 2008 Global Financial Crisis ............................................................ 13
6.1 Research Findings and Conclusion .................................................................................... 14
Bibliography ............................................................................................................................ 16
Appendix A: Constituent Members of the Hang Seng Index 2004-2008 ............................... 18
.................................................................................................................................................. 18
Appendix B: Minimum Variance Portfolio Weightings and Descriptive Statistics ............... 19
.................................................................................................................................................. 19
Appendix C: Matlab Script File “FI6012_Portfolio_Risk_Analysis_Assignment.m” ............ 20
3 | P a g e
Portfolio Risk Analysis
1.1 Introduction
Value at Risk (VaR) modelling is a statistical methodology in which financial institutions can
quantify their potential risk of capital loss over a certain risk horizon (Alexander, 2008)
(Doric, 2011), (Kourouma, et al., 2011). Under the Basel II Accord for minimum market risk
capital requirements in financial institutions, the VaR approach was the standard risk
management tool utilized to calculate the level of capital reserves in order to survive financial
crises, specifically, “regulatory capital is based on … the 1% 10-day VaR if the value-at-risk
approach is used. (Alexander, 2008, p. 401)”.
The simplicity of the VaR methodology provides risk managers the ability to provide a
succinct and non-technical estimate of potential downside risk over a future time horizon to a
specified degree of confidence. However, it is the accuracy of its measurement that
incorporates a “challenging statistical problem” (Doric, 2011), with assumptions lending to
significant model risk.
One of the many common criticisms of the use of VaR as a measurement for significant
financial downside risk is its inability to estimate the magnitude of the exceptional losses. For
this reason, this paper includes the Expected Tail Loss (ETL) measure proposed by Arzner et.
al. implying that it provides the “worst conditional expectation measure of risk” (Artzner, et
al., 1999). ETL statistical modelling provides an estimation of the expected loss given that
the loss exceeds the VaR (Alexander, 2008, p. 128).
This paper compares the three Value at Risk and Expected Tail Loss modelling techniques on
the Hang Seng index (HSI) and a Minimum Variance Portfolio (MVP) of the 27 consistent
members of the HSI during the period 2004 – 2008. The models, namely Systematic Normal
Linear, Student-t Linear and Generalized Pareto Distribution, were chosen following a
preliminary empirical analysis of the HSI and MVP returns over the 2004 – 2007 period and
tested over 2008 to highlight the competency of the models when exposed to the Global
Financial Crisis. Integrated into the analysis is a discussion on the advancements in modern
risk modelling, and how the Basel committee intend to correct the shortcomings implicit to
the Basel II Accord which many commentators believe it could have and has contributed to
economic instability (Sollis, 2009), (Danielsson, et al., 2001), (Rebonato, 2010) , (Jorion,
2009)
1.2 Research Aims and Hypotheses
The aim of the paper is two-fold. First, within the scope of the research paper is to determine
the most accurate VaR model of both the HSI and MVP, and what assumptions and
characteristics of each model make them more or less suitable. Second, this author would like
to prove the hypothesis that the MVP created through application of the standard mean-
variance portfolio selection framework developed by Harry Markowitz will outperform the
4 | P a g e
Portfolio Risk Analysis
Hang Seng Index. (Markowitz, 1952) Outperformance will be measured in terms of an out-
of-sample test through the 2008 financial crisis where the respective daily VaR estimates and
returns will be measured and compared against one another. The optimal weightings of the
MVP will be calculated at 31/12/2007, with the expected daily return set equal to the HSI
equivalent, and weightings held static over the course of the 2008 trading year.
1.3 Hang Seng Index
The Hang Seng Index (HSI) is a capitalization-weighted index of a selection of companies
from the Stock Exchange of Hong Kong. The core elements of the index are divided into four
sub-indices: Commerce and Industry, Finance, Utilities, and Properties (Bloomberg, 2015).
The HSI is included in the analysis as a benchmark of comparison to the Minimum Variance
Portfolio derived from its members. Appendix A shows the 27 consistent members of the
index throughout the window of analysis 2004 – 2008, from which the MVP will be selected.
Figure 1 shows that the number of observations in the sample for portfolio selection and for
preliminary testing and VaR/ETL initial estimation is 989, allowing for the 245 observations
in 2008 to be used in an out-of-sample test for the VaR models.
Figure 1: Trading days per year Hang Seng Index 2004-2008
1.4 Minimum Variance Portfolio
Modern Portfolio Theory (MPT) was first introduced by Harry Markowitz in his paper
‘Portfolio Selection’, in which he introduced the concept of combining the investor’s utility
to maximise expected return whilst minimise the variance on an investment portfolio
(Markowitz, 1952). Prior to this seminal paper, the investment banking industry focused on
finding and investing in what Pachamanova describes as “winners", i.e. assets that appeared
to provide high expected returns irrespective of risk (Pachamanova & Fabozzi, 2010). This
framework of individual asset selection ignored the combined effect each singular asset
would have on the total portfolio return, an aspect identified by Markowitz’s mean-variance
model stating “to reduce risk, it is necessary to avoid a portfolio whose securities are all
highly correlated with each other” (Markowitz, 1959).
Year Count Cumulative
2004 249 249
2005 247 496
2006 247 743
2007 246 989
2008 245 1234
No. of Observations by Year
5 | P a g e
Portfolio Risk Analysis
Figure 2: The Efficient Frontier of Optimal Portfolios (Alexander, 2008, p. 247)
The mean-variance portfolio optimization model suggested by Markowitz, can be adapted to
suit our analysis in its ability to identify the unique optimal portfolio selection from a large
collection of assets with the lowest risk (variance of return) for any given expected rate of
return, or with the highest expected return for any given risk as illustrated in Figure 2.
Therefore, the portfolio selection was constrained to provide the Minimum Variance Portfolio
(MVT) with an expected daily return greater than or equal to that of the HSI mean return
over the 2004 – 2007 horizon.
The simplifications and assumptions of the standard optimization model proposed by
Markowitz have been subject to similar criticisms to that of traditional VaR models,
implicitly within the assumption that the each of the assets’ returns are normally distributed
and the input parameters are thereby set to the arithmetic mean for expected return and
variance of return for risk. Empirical research has shown that often the distribution of equity
returns deviates from normality exhibiting “excess kurtosis” (Kon, 1984). Non-normality of
returns indicates that the use of the variance of returns is inappropriate (Sharpe, et al., 1991).
Figure 3: Framework of Portfolio Optimisation Methodology (Radlak, 2008) adapted
6 | P a g e
Portfolio Risk Analysis
The standard mean-variance optimisation model is implemented in Matlab utilizing a
quadratic programming solver i.e. an optimisation problem with a quadratic objective
function (variance-covariance matrix of returns) and linear constraints (expected return
equal to the HSI mean return, no-shorting constraint and portfolio weights/allocations must
sum to one). Several iterative and search algorithms exist to solve for quadratic programming
problems such as the Active Set method, Augmented Lagrangian method and the Conjugate
Gradient method (Nocedal & Wright, 2006)
Appendix B shows the weightings derived from the mean-variance portfolio optimization
constrained to have the same expected return as the Hang Seng Index over the 4 year period
2004 to 2007. It also shows that the standard deviation of daily returns for the MVT is
significantly lower that of the HSI over the 4 year period, implying less risk for the same
return.
2.1 Preliminary Testing of Returns
For the purposes of VaR model selection, and perhaps a view on how the application of
incorrect models could lead to substantial model risk, the distribution of the HSI and MVP
returns over 2004 – 2007 will be analysed by means of a battery of standardised tests for
normality, stationarity and autocorrelation.
2.2 Descriptive Statistics
The distributions of the daily returns for the HSI and MVP show signs of non-normality, with
high levels of excess kurtosis and slight negative skew. The evidence of leptokurtic
distributions indicate that the portfolio and index have a higher probability of realising large
negative outlier returns than the normal distribution would predict.
7 | P a g e
Portfolio Risk Analysis
Figure 4: Histograms of MPT (left) and HSI (right) Returns 2004 - 2007
.
2.3 Normality of Returns
In order the prove the assumption of the returns following non-normal distributions, the same
model validation process as (Alexander, 2008), (Kourouma, et al., 2011) was followed, where
Jarque-Bera test for normality was conducted on the HSI and MVP daily returns. Alexander
states that “the Jarque–Bera test applies to any random variable whenever we need to justify
an assumption of normality” (Alexander, 2008, p. 158) i.e. the test is conducted under the
null hypothesis that the daily returns are normally distributed.
The results of the tests are incorporated into the QQ-plot (Figure 5), signifying to reject the
null hypothesis that the daily returns for both MVP and HSI follow a normal distribution.
Figure 5 also depicts an abundance of both negative and positive outliers. These “fat-tail”
attributes of the daily returns provide an indication for the suitability of a Student-t
distribution being fitted to both the index and portfolio, as suggested by (Sollis, 2009). Sollis
warned of the implications of assuming normality when a fatter tailed distribution should be
utilized stating it could “lead to an underestimate of the true VaR” (Sollis, 2009).
Furthermore, the prevalence of negative outlier returns encourage the application of Extreme
Value Theory (EVT) for estimation of negative tail risk, focusing solely on the “tail
behaviour of asset returns” (Kourouma, et al., 2011).
-0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03 0.040
20
40
60
80
100
120
140Histogram of Optimized Portfolio Daily Returns 2004-2007
Optimized Portfolio Daily Returns
Fre
quency
-0.06 -0.04 -0.02 0 0.02 0.04 0.060
20
40
60
80
100
120
140
160
180
200Histogram of Hang Seng Index Daily Returns 2004-2007
Hang Seng Index Daily Returns
Fre
quency
Mean
Return:
0.00078535
Excess
Kurtosis:
1.8595
Skewness:
-0.26298
Mean
Return
0.00078535
Excess
Kurtosis:
2.7252
Skewness:
-0.16533
8 | P a g e
Portfolio Risk Analysis
Figure 5: Quantile-Quantile Plot of MVT (top) and HSI (bottom)
2.4 Autocorrelation of Returns and Stationarity
The Basel II regulatory framework sets the VaR estimate based on a 10 day risk horizon, and
accepts the use of scaling up the 1-day VaR by multiplying by the square root of 10
(Danielsson, et al., 2001). However, this assumption assumes that the returns are
independently and identically distributed (i.i.d.) i.e. no autocorrelation in returns (Alexander,
2008, p. 21).
The autocorrelation of daily returns were examined qualitatively using correlelograms and
Partial-ACF plots and quantitatively using the “Ljung-Box Q-test”. This popular technique
for testing autocorrelation tests “the null hypothesis for this test is that the first m
autocorrelations are jointly zero” (Ljung & Box, 1978). Figure 6 merges both the illustration
of the ACF and PACF plots indicating statistically significant lags at lag 3 for both the MVP
and HSI. The results of the Ljung-Box Q-tests are also provided in Figure 6, rejecting the
null hypothesis in both cases.
This result implies that the use of the scaling method globally used and accepted under the
Basel II framework will result in under-estimation or over-estimation of the VaR, thereby
increasing the model risk unless measures are taken to transform the time series.
Compounded in the result of significant autocorrelation is the inference that the daily returns
-4 -3 -2 -1 0 1 2 3 4-0.04
-0.02
0
0.02
0.04
Standard Normal Quantiles
Quantile
s o
f O
ptim
ized P
ort
folio D
aily R
etu
rns QQ-Plot of Optimized Portfolio Daily Returns 2004-2007
-4 -3 -2 -1 0 1 2 3 4-0.06
-0.04
-0.02
0
0.02
0.04
0.06
Standard Normal Quantiles
Quantile
s o
f H
SI
Index D
aily R
etu
rns
QQ-Plot of Hang Seng Index Daily Returns 2004-2007
Jarque-Bera p-value:
0.001
Null Hypothesis of
Gaussian returns:
Reject with 95%
Confidence
Jarque-Bera p-value:
0.001
Null Hypothesis of
Gaussian returns:
Reject with 95%
Confidence
9 | P a g e
Portfolio Risk Analysis
data may be non-stationary, given that “for stationary processes, autocorrelation between
any two observations only depends on the time lag h between them” (Mathworks, 2014).
Figure 6: ACF and PACF plots for MVP (top row) and HSI (bottom row)
This result was investigated using the Augmented Dickey-Fuller and KPSS tests for a unit
root in the daily returns i.e. a time series with a stationary first difference. Both tests reject the
null hypothesis that the MVP and HSI daily returns follow a trend stationary process over the
period 2004 – 2007. By definition, it can be assumed that the mean and variance of both
variables are not finite constants (Alexander, 2008, p. 203).
In summary, the preliminary testing resulted in almost identical attributes for both the MVP
and HSI daily returns 4 year time series’. Both showed leptokurtic distributions with slight
negative skewness, statistically significant autocorrelation, and followed a non-stationary
process.
In terms of VaR model selection, the Parametric Normal Linear VaR and ETL will be
implemented as a benchmark model which will provide a good indication of the
consequences implicit to model risk and the use of risk models which do not accurately
reflect the distribution of returns. As an extension, the Parametric Student-T Linear VaR
model will be applied with a view to improving on the Parametric Normal Linear VaR model
in its ability to capture the “fat tails” (Sollis, 2009). Finally, deviating from the traditional
0 2 4 6 8 10 12 14 16 18 20-0.5
0
0.5
1
Lag
Sam
ple
Auto
corr
ela
tion
ACF of Optimized Portfolio Daily Returns 2004-2007
0 2 4 6 8 10 12 14 16 18 20-0.5
0
0.5
1
Lag
Sam
ple
Part
ial A
uto
corr
ela
tions
PACF of Optimized Portfolio Daily Returns 2004-2007
0 2 4 6 8 10 12 14 16 18 20-0.5
0
0.5
1
Lag
Sam
ple
Auto
corr
ela
tion
ACF of Hang Seng Index Daily Returns 2004-2007
0 2 4 6 8 10 12 14 16 18 20-0.5
0
0.5
1
Lag
Sam
ple
Part
ial A
uto
corr
ela
tions
PACF of Hang Seng Index Daily Returns 2004-2007
Ljung-Box Q-test p-value:
0.031944
Null Hypothesis of no
Autocorrelation:
Reject with 95%
Confidence
Ljung-Box Q-test p-value:
0.013336
Null Hypothesis of no
Autocorrelation:
Reject with 95%
Confidence
10 | P a g e
Portfolio Risk Analysis
VaR methodology, the Generalised Pareto Distribution VaR model will be used in order to
view replicate the distribution explicitly at the fat tails.
3.1 Value-at-Risk and ETL Models
In this section, the three VaR and ETL models will be implemented, the assumptions inherent
to each model will be described and related to the attributes considered in Section 2.1 of the
MVP and HSI daily returns. The VaR and ETL model estimates will be reported as at
31/12/2007 (Figure 7 ) and each VaR model will be back-tested and compared over 2008, the
Global Financial Crisis (Figures 8 and 9 ). All VaR and ETL estimates are reported as a
percentage of the portfolio value as per Alexander and parametric formulae may be seen in
Matlab implementation. Discounted mean returns are excluded from the Parametric Normal
and Student-T Linear VaR and ETL estimates as these are assumed to be nil as per the Basel
II Directives.
3.2 Parametric Normal Linear VaR
As summarised in Section 2.4, the Parametric Normal Linear VaR was implemented as a tool
for benchmarking the improved risk model against. The two fundamental assumptions of the
model, “i.i.d. and normally distributed” (Alexander, 2008, p. 18) daily returns are directly
violated by that of the MVP and HSI. With large excess kurtosis exhibited by both sets of
returns, it is expected that this model will underestimate the VaR level.
The equally weighted moving average of the constant variance (implied by stationarity)
results in what Alexander describes as “ghost features”, where the Parametric Normal Linear
VaR will remain high or low for exactly the number of days in the sample period following
an extreme outlier return (Alexander, 2008, p. 20). The effect of “ghost features” can be de-
sensitized by increasing the observations in the sample. Therefore, the back-test implemented
utilized 4 years of historical returns at each iteration in order to re-calculate the covariance
matrix for the updated VaR estimate over the 245 trading days in 2008.
The Parametric Normal Linear VaR performed very poorly, as expected, in the back-tests
with 27 exceedances for the MVP and 34 exceedances for the HSI. Therefore, the model
rejected the null hypothesis of Kupiec’s unconditional coverage test, that the indicator
function has a constant “success” or “exceedance” probability equal to the significance level
chosen, 1%.
11 | P a g e
Portfolio Risk Analysis
3.3 Student-T Linear VaR
In order to fit the leptokurtic daily returns of both the HSI and MVP, the same methodology
deployed in Section 3.2 was followed, replacing the normal distribution with the Student-T
distribution per Alexander “the normal linear VaR model can be extended to the case where
the portfolio’s returns, or the risk factor returns, have leptokurtic and skewed distributions …
Student t distributed VaR” (Alexander, 2008, p. 129)
This required the additional parameter, degrees of freedom ν, to be estimated by using the
maximum likelihood estimation tool in Matlab to fit the daily returns distribution. This
caused problems in the back-testing capability of the model, as the value of ν contracted
during November 2008 during times of high volatility and outlier negative returns and the
value dipping below 2. This resulted in the Student-T VaR formula providing a complex
number due to the calculation of the square root of a negative number.
Despite this set-back, the Student-T Linear VaR model outperformed the Parametric Normal
Linear VaR in terms of the back-test over the 2008 Financial Crisis, with 27 exceedances for
the HSI model and only 9 exceedances for the MVP model. Despite this increment in
performance relative to its predecessor, the Student-T Linear VaR model was rejected when
tested for unconditional coverage with the Kupiec Test.
Figure 7 highlights a stark increase in both VaR and ETL estimates with the Student-T
Linear model, highlighting its ability to forecast large negative outlier returns with more
precision.
3.4 Generalised Pareto Distribution VaR
As identified in the preliminary testing, the non-normal distribution of the HSI and MVP
daily returns characterised by significant excess kurtosis requires a risk estimation technique
which deviates from the restrictive model assumptions as per the traditional linear VaR and
ETL methodology. Extreme Value Theory is a risk management technique which explicitly
“focuses on the tail behaviour of asset returns” (Kourouma, et al., 2011).
Specifically, the “Generalised Pareto Distribution” (GPD) risk modelling framework
“applies to only those returns above some pre-defined threshold u” (Alexander, 2008, p.
167). The choice of u is highlighted as a potential source of model risk is highlighted by both
Kourouma and Alexander, specifying that it is important to have enough observations below
the specified threshold in order to “obtain a reasonably accurate estimate of the GPD scale
and tail index parameters, β and ξ” (Alexander, 2008, p. 168). Furthermore, Kourouma
points out that there is no satisfactory program which chooses the optimal value for the
threshold u, leaving it to the discretion of the risk manager.
12 | P a g e
Portfolio Risk Analysis
Given that the sample size of daily returns for both the HSI and MPT only extends 998 days,
the choice of a high threshold u was imperative to the success of this risk model. The
threshold was set at 15%, incorporating 148 left-tail returns in order to make accurate
estimates of the GPD distribution parameters.
On implementation of GPD VaR and ETL models the daily returns are first normalized by
subtracting the sample mean and divided by the standard deviation. The GPD parameters are
then estimated using maximum likelihood estimation in Matlab (Alexander, 2008, p. 169)
Once the GPD VaR and ETL estimates are computed, they “are then de-normalised by
multiplying by the return standard deviation and adding the mean” (Chopping, 2014)
Figure 7 shows the high VaR and ETL estimates produced by the GPD model relative to both
the Student-T Linear model and Parametric Normal Linear Model. In the 2008 back-test the
GPD VaR model dominates the other models for both HSI and MVP, with only 2 and 3
exceedances observed respectively. The GPD Model was also the only model failing to reject
the null hypothesis of unconditional convergence per the Kupiec test performed in Matlab.
Figure 7: VaR and ETL Model Estimates as at 02/01/2008 and Back-Test Results
02/01/2008 - 31/12/2008
Parametric Normal Linear 1% 1-day VaR 1% 1-day ETL
In-Sample Test
Exceedances
Hang Seng Index 2.64% 3.02% 34
Mean Variance Portfolio 2.04% 2.33% 27
Student-T Linear 1% 1-day VaR 1% 1-day ETL
2008 In-Sample Test
Exceedances
Hang Seng Index 2.99% 6.97% 28
Mean Variance Portfolio 2.31% 3.79% 9
Generalized Pareto
Distribution
1% 1-day VaR
(u=15%)
1% 1-day ETL
(u=15%)
2008 In-Sample Test
Exceedances
Hang Seng Index 8.48% 9.49% 2
Mean Variance Portfolio 7.12% 8.26% 3
02/01/2008 Only
13 | P a g e
Portfolio Risk Analysis
3.5 Back-testing over 2008 Global Financial Crisis
The Basel Directive identifies the importance of backtesting“The competent authorities shall
examine the institution capability to perform back-testing on both actual and hypothetical
changes in the portfolio value.” (Directive 2010/76/EU of the European Parliament and of the
Council, 2010) The Bernoulli back-testing approach was used for the daily VaR estimates on
the three models and applied to the Hang Seng Index and the static Minimum Variance
Portfolio. Bernoulli “successes” or VaR exceedances are highlighted with markers in Figure
8 and Figure 9. This method is analogous to that outlined by Alexander, “Regulators
recommend a very simple type of backtest, which is based on a 1% daily VaR estimate and
which covers a period of only 250 days” (Alexander, 2008).
Figure 8: Back-test of HSI VaR Models over 2008 Global Financial Crisis
Figure 8 illustrates the performance of the three VaR Model estimates over the year of the
2008 Financial Crisis. It is clear that the GPD VaR model was the only methodology accurate
in its forecasting ability in financial downturn. Perhaps this validates Rebonato’s theory
proposed in that the modern risk management framework should be able to utilize “plural
models”, deviating on the traditional methods employed by market participants searching for
the “unique, true model” (Rebonato, 2010).
0 50 100 150 200 250-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.151% Daily Normal Linear VaR, Student-t Linear and GPD VaR vs. Daily Returns of HSI 2008
HSI Daily Returns
HSI Daily 1% Normal Linear VaR
HSI Daily 1% Student-t Linear VaR
HSI Daily 1% GPD VaR
Normal Linear VaR Exceedance
Student-t Linear VaR Exceedance
GPD VaR Exceedance
Number of Normal Linear VaR
Exceedances :
34
Number of Student-t Linear VaR
Exceedances :
28
Number of GPD VaR
Exceedances :
2
14 | P a g e
Portfolio Risk Analysis
Figure 9: Back-test of MVP VaR Models over 2008 Global Financial Crisis
Figure 9 again depicts the prevalence of the GPD VaR model for MVP back-tested over 2008
over the alternative linear methodology.
6.1 Research Findings and Conclusion
At the outset of this research paper the aims were outlined as follows:
1. Determine the most accurate VaR model of both the HSI and MVP.
It is clear form the back-testing results that the GPD VaR outperforms the alternatives in
terms of providing an accurate assessment of tail risk with a degree of confidence which
holds over the 2008 financial crisis.
2. Prove the hypothesis that the MVP created through application of the standard mean-
variance portfolio selection framework developed by Harry Markowitz will outperform
the Hang Seng Index.
0 50 100 150 200 250-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.151% Daily Normal Linear VaR, Student-t Linear and GPD VaR vs. Daily Returns of Minimum Variance Portfolio 2008
Port Daily Returns
Port Daily 1% Normal Linear VaR
Port Daily 1% Student-t Linear VaR
Port Daily 1% GPD VaR
Normal Linear VaR Exceedance
Student-t Linear VaR Exceedance
GPD VaR Exceedance
Number of Normal Linear VaR
Exceedances :
27
Number of Student-t Linear VaR
Exceedances :
9
Number of GPD VaR
Exceedances :
3
15 | P a g e
Portfolio Risk Analysis
Figure 10 and Figure 11 implies that this hypothesis has been proven.
Relative Performance 02/01/2008 - 31/12/2008
Equity Group Mean Standard Deviation
Minimum Variance Portfolio -0.14% 2.4%
Hang Seng Index -0.26% 3.2% Figure 10: HSI vs. MVP 2008
Figure 1:HSI vs MVP - VaR and diff returns
-12.00%
-10.00%
-8.00%
-6.00%
-4.00%
-2.00%
0.00%
2.00%
4.00%
6.00%
Minimum Variance Portfolio Versus Hang Seng Index: Net Daily Returns and GPD Value-at-Risk
Portfolio Daily Returns - HIS Daily Returns HSI GPD VaR Portfolio GPD VaR
16 | P a g e
Portfolio Risk Analysis
Bibliography
Alexander, C., 2008. Market Risk Analysis Volume 1: Quantitative Methods in Finance.
s.l.:John Wiley and Sons.
Alexander, C., 2008. Market Risk Analysis Volume 2: Practical Financial Econometrics.
s.l.:John Wiley and Sons.
Alexander, C., 2008. Market Risk Analysis Volume 4: Value-at-Risk Models. s.l.:John Wiley
and Sons.
Artzner, P., Delbaen, F., Eber, J. M. & Heath, D., 1999. Coherent measures of risk.
Mathematical Finanace, 9(3), pp. 203-228.
Bloomberg, 2015. www.bloomberg.com. [Online]
Available at: http://www.bloomberg.com/quote/HSI:IND
[Accessed 06 04 2015].
Chopping, T., 2014. Scaling Laws: a viable alternative to value at risk?. Quantitative
Finance, 14(5), pp. 889-911.
Danielsson, J. et al., 2001. An academic response to Basel II.
Directive 2010/76/EU of the European Parliament and of the Council, 2010. Directive
2010/76/EU of the European Parliament and of the Council of 24 November 2010 amending
Directives 2006/48/EC and 2006/49/EC as regards capital requirements for the trading book
and for re-securitisations. s.l.:THE EUROPEAN PARLIAMENT AND THE COUNCIL OF
THE EUROPEAN UNION.
Doric, D., 2011. RETURN DISTRIBUTION AND VALUE AT RISK ESTIMATION FOR
BELEX15. Yugoslav Journal of Operations Research, 21(1), pp. 103-118.
Jorion, P., 2009. Risk Management lessons from the credit crisis. European Financial
Management, pp. 923-933.
Kon, S., 1984. Models of Stock Returns--A Comparison. The Journal of Finance, 39(1), pp.
147-165.
Kourouma, L., Dupre, D., Sanfilippo, G. & Taramasco, O., 2011. Extreme Value at Risk and
Expected Shortfall during Financial Crisis, Grenoble: Cerag.
Ljung, G. & Box, G., 1978. On a Measure of Lack of Fit in Time Series Models. Biometrika,
Volume 66, pp. 67-72.
Markowitz, H., 1952. Portfolio selection. The Journal of Finance, 7(1), pp. 77-91.
Markowitz, H., 1959. Portfolio selection: efficient diversification of investments. New York:
Basil Blackwall.
17 | P a g e
Portfolio Risk Analysis
Mathworks, 2014. www.mathworks.com. [Online]
Available at: http://uk.mathworks.com/help/econ/autocorrelation-and-partial-
autocorrelation.html
[Accessed 05 04 2015].
Michaud, R., 1989. The Markowitz optimization enigma: is' optimized 'optimal?. Financial
Analysts Journal, 45(1), pp. 31-42.
Nocedal, J. & Wright, S. J., 2006. Numerical Optimization. 2 ed. s.l.:Springer.
Pachamanova, D. & Fabozzi, F., 2010. Simulation and optimization in finance: modeling with
MATLAB,@ RISK, or VBA (Vol. 173). s.l.:John Wiley & Sons.
Rebonato, R., 2010. Post-crisis financial risk management: some suggestions. Journal of Risk
Management in Financial Institutions, 3(2), pp. 148-155.
Sharpe, G. J., Alexander, J. & Bailey, V., 1991. Investments. 6 ed. New York: John Wiley.
Sollis, R., 2009. Value at Risk: a critical overview. Journal of Financial Regulation and
Compliance, 17(4), pp. 398 - 414.
18 | P a g e
Portfolio Risk Analysis
Appendix A: Constituent Members of the Hang Seng Index 2004-2008
Hang Seng Index Members GICS Sector
02/01/2004 31/12/200802/01/2004 -
31/12/2008 101 HK Equity Financials
5 HK Equity 5 HK Equity 101 HK Equity 1038 HK Equity Utilities
941 HK Equity 941 HK Equity 1038 HK Equity 11 HK Equity Financials
13 HK Equity 2628 HK Equity 11 HK Equity 1199 HK Equity Industrials
11 HK Equity 857 HK Equity 1199 HK Equity 12 HK Equity Financials
2388 HK Equity 388 HK Equity 12 HK Equity 1249772D HK Equity Financials
16 HK Equity 16 HK Equity 1249772D HK Equity 13 HK Equity Industrials
1249772D HK Equity 939 HK Equity 13 HK Equity 16 HK Equity Financials
883 HK Equity 1249772D HK Equity 16 HK Equity 19 HK Equity Financials
762 HK Equity 1398 HK Equity 19 HK Equity 2 HK Equity Utilities
2 HK Equity 883 HK Equity 2 HK Equity 23 HK Equity Financials
3 HK Equity 386 HK Equity 23 HK Equity 2388 HK Equity Financials
6 HK Equity 13 HK Equity 2388 HK Equity 267 HK Equity Industrials
12 HK Equity 3328 HK Equity 267 HK Equity 291 HK Equity Consumer Staples
66 HK Equity 1088 HK Equity 291 HK Equity 293 HK Equity Industrials
4 HK Equity 11 HK Equity 293 HK Equity 3 HK Equity Utilities
293 HK Equity 330 HK Equity 3 HK Equity 330 HK Equity Consumer Discretionary
19 HK Equity 2318 HK Equity 330 HK Equity 4 HK Equity Financials
267 HK Equity 3988 HK Equity 4 HK Equity 494 HK Equity Consumer Discretionary
1038 HK Equity 19 HK Equity 494 HK Equity 5 HK Equity Financials
494 HK Equity 2 HK Equity 5 HK Equity 551 HK Equity Consumer Discretionary
179 HK Equity 3 HK Equity 551 HK Equity 6 HK Equity Utilities
23 HK Equity 12 HK Equity 6 HK Equity 66 HK Equity Industrials
551 HK Equity 23 HK Equity 66 HK Equity 762 HK Equity Telecommunication Services
330 HK Equity 2388 HK Equity 762 HK Equity 8 HK Equity Telecommunication Services
101 HK Equity 101 HK Equity 8 HK Equity 883 HK Equity Energy
8 HK Equity 494 HK Equity 883 HK Equity 941 HK Equity Telecommunication Services
97 HK Equity 17 HK Equity 941 HK Equity
992 HK Equity 83 HK Equity GICS Sector Count
1199 HK Equity 688 HK Equity Financials 10
20 HK Equity 6 HK Equity Utilities 4
291 HK Equity 4 HK Equity Industrials 5
511 HK Equity 762 HK Equity Consumer Staples 1
363 HK Equity 267 HK Equity Consumer Discretionary 3
144 HK Equity Telecommunication Services 3
CHNETQ HK Equity Energy 1
66 HK Equity Total Members 27
700 HK Equity
291 HK Equity
2038 HK Equity
293 HK Equity
8 HK Equity
1199 HK Equity
551 HK Equity
1038 HK Equity
Hang Seng Index Members by Date
*Consistent Members
19 | P a g e
Portfolio Risk Analysis
Appendix B: Minimum Variance Portfolio Weightings and Descriptive Statistics
Portfolio optimisation obtained the following:
EquityMinimum Variance
Portfolio Weightings
101 HK Equity 0.00% Equity Optimized Weightings Mean Std Dev Skewness Excess Kurtosis
1038 HK Equity 0.00% 11 HK Equity 2.94% 0.05% 1.09% 142.25% 13.06
11 HK Equity 2.94% 2 HK Equity 30.80% 0.04% 0.88% -2.55% 2.84
1199 HK Equity 0.00% 23 HK Equity 3.22% 0.09% 1.57% 2.74% 4.60
12 HK Equity 0.00% 3 HK Equity 16.62% 0.09% 1.31% 74.93% 5.62
1249772D HK Equity 0.00% 330 HK Equity 6.39% 0.17% 2.17% 55.47% 6.05
13 HK Equity 0.00% 6 HK Equity 12.71% 0.04% 1.02% -39.06% 4.06
16 HK Equity 0.00% 66 HK Equity 14.92% 0.11% 1.45% 74.98% 4.88
19 HK Equity 0.00% 883 HK Equity 3.16% 0.17% 2.21% 33.67% 2.27
2 HK Equity 30.80% 941 HK Equity 9.22% 0.19% 1.93% 22.89% 1.30
23 HK Equity 3.22% Total Weight 100.00%
2388 HK Equity 0.00%
267 HK Equity 0.00%
291 HK Equity 0.00% ** Figures Based on returns in date range 02/01/2004 - 31/12/2007
293 HK Equity 0.00%
3 HK Equity 16.62%
330 HK Equity 6.39% Index Mean Std Dev Skewness Excess Kurtosis
4 HK Equity 0.00% Hang Seng Index 0.079% 1.13% -16.53% 2.73
494 HK Equity 0.00% ** Figures Based on returns in date range 02/01/2004 - 31/12/2007
5 HK Equity 0.00%
551 HK Equity 0.00%
6 HK Equity 12.71%
66 HK Equity 14.92%
762 HK Equity 0.00%
8 HK Equity 0.00%
883 HK Equity 3.16%
941 HK Equity 9.22%
Hang Seng Index Descriptive Statistics
*Portfolio Mean Daily Return = 0.079%
Minimum Variance Portfolio Descriptive Statistics
* Portfolio Standard Deviation = 0.876%
20 | P a g e
Portfolio Risk Analysis
Appendix C: Matlab Script File “FI6012_Portfolio_Risk_Analysis_Assignment.m”
% FI6012: Portfolio Risk Analysis % Barry Sheehan 0854867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1) Initialise Share Price Data: % All data taken from Bloomberg on 30/03/2015 % Daily HSI Share and Index values from 02/01/2004 - 31/12/2008 HSI_Index = xlsread('Hang_Seng_Data.xlsx','HSI_Index');% 1234 by 1 matrix HSI_Share = xlsread('Hang_Seng_Data.xlsx','HSI_Share');% 1234 by 27 matrix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2) Calculate Daily Returns, Expected Returns, Covariance: HSI_Index_Ret = price2ret(HSI_Index); HSI_Share_Ret = price2ret(HSI_Share); % Mean/Expected Return over first 4 years: Exp_Daily_Return_HSI_Index = mean(HSI_Index_Ret(1:988,1)); Exp_Daily_Return_HSI_Share = mean(HSI_Share_Ret(1:988,:)); % Covariance Matrix Return over first 4 years: Share_Cov = cov(HSI_Share_Ret(1:988,:)); % Test Share Covariance Matrix for Symmetry: if norm(Share_Cov-Share_Cov')>0 errmsg = 'Error: Covariance Matrix is not symmetric'; else disp('Covariance Matrix is Symmetric') end Eigenvalues=eig(Share_Cov); if min(Eigenvalues)<0 errmsg = 'Covariance Matrix is not Positive Definite'; else disp('Covariance Matrix is Positive Definite') end % Result: Covariance Matrix is Positive Defnite and Symmetric. % Therefore, solution to portfolio optimisation will be a global minimum. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 3) Create Optimal Mean-Variance Portfolio Weightings with same % Expected Daily Return as Hang Seng Index % Objective Function: 0.5(x'.Cov.x) Cov=2*Share_Cov; % Optimisation Constraints: % i) Return Constraint: -Mean.x<=-R (inequality format accepted in quadprog % functionality) Mean=-Exp_Daily_Return_HSI_Share; R=-Exp_Daily_Return_HSI_Index; % ii) Sum of Weights must equal one: e'.x=1 Aeq=ones(1,length(Exp_Daily_Return_HSI_Share)); beq=1; % iii) No Short-selling Allowed lb=zeros(length(Exp_Daily_Return_HSI_Share),1); % Mean-variance Portfolio Optimisation: % Minimize Variance s.t. % i) Expected Return = HSI Index annualised Ret % ii) Sum of Portfolio Weights = 1 % iii)No Short-Selling Allowed i.e. Portfolio Weights >=0 [PortfolioWeights]=quadprog(Cov,[],Mean,R,Aeq,beq,lb,[],[],[]); % Theoretical Min Variance Portfolio Daily Returns: (2004 - 2007): Hist_Port_DailyRet = PortfolioWeights'*HSI_Share_Ret(1:988,:)'; % Min Variance Portfolio Expected Daily Returns and Std Dev: Portfolio_Exp_SD = sqrt(PortfolioWeights'*Share_Cov*PortfolioWeights); Portfolio_Exp_Return = PortfolioWeights'*Exp_Daily_Return_HSI_Share'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 4) Create Histograms for Returns Data % i) Plot histogram of daily Optimized Portfolio Daily Returns 2004 - 2007: figure subplot(1,2,1) histfit(Hist_Port_DailyRet) title('Histogram of Optimized Portfolio Daily Returns 2004-2007') xlabel('Optimized Portfolio Daily Returns') ylabel('Frequency')
21 | P a g e
Portfolio Risk Analysis
str1 = {'Mean Return:' ,num2str(mean(Hist_Port_DailyRet)),... 'Excess Kurtosis:' ,num2str(kurtosis(Hist_Port_DailyRet)-3),... 'Skewness: ' ,num2str(skewness(Hist_Port_DailyRet))}; annotation('textbox', [0.36,0.7,0.055,0.21],'String', str1); % ii) Plot histogram of daily Hang Seng Index Daily Returns 2004 - 2007: subplot(1,2,2) histfit(HSI_Index_Ret(1:988,1)) title('Histogram of Hang Seng Index Daily Returns 2004-2007') xlabel('Hang Seng Index Daily Returns') ylabel('Frequency') str2 = {'Mean Return' ,num2str(mean(HSI_Index_Ret(1:988,1))),... 'Excess Kurtosis:' ,num2str(kurtosis(HSI_Index_Ret(1:988,1))-3),... 'Skewness: ' ,num2str(skewness(HSI_Index_Ret(1:988,1)))}; annotation('textbox', [0.8,0.7,0.055,0.21],'String', str2); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 5) Time-series Testing: % i) Jarque-Bera Test for Normality [h1,p1] = jbtest(Hist_Port_DailyRet); if h1==1 h1_String='Reject with 95% Confidence'; else h1_String='Fail to reject with 95% Confidence'; end [h2,p2] = jbtest(HSI_Index_Ret(1:988,1)); if h2==1 h2_String='Reject with 95% Confidence'; else h2_String='Fail to reject with 95% Confidence'; end % ii) QQ-Plots for Visual illustration of Normality figure subplot(2,1,1) qqplot(Hist_Port_DailyRet) title('QQ-Plot of Optimized Portfolio Daily Returns 2004-2007') ylabel('Quantiles of Optimized Portfolio Daily Returns') str1 = {'Jarque-Bera p-value: ' ,num2str(p1),... 'Null Hypothesis of Gaussian returns: ',h1_String}; annotation('textbox', [0.75,0.65,0.10,0.154],'String', str1); subplot(2,1,2) qqplot(HSI_Index_Ret(1:988,1)) title('QQ-Plot of Hang Seng Index Daily Returns 2004-2007') ylabel('Quantiles of HSI Index Daily Returns') str2 = {'Jarque-Bera p-value: ' ,num2str(p2),... 'Null Hypothesis of Gaussian returns: ',h2_String}; annotation('textbox', [0.75,0.15,0.1,0.154],'String', str2); % Result of i) and ii): Both Hang Seng Index and Optimised Portfolio % Returns Non-Normally Distributed with 95% confidence %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % iii) Test for Autocorrelation % % a) Ljung-Box Q-test for residual autocorrelation Portfolio_Residual = Hist_Port_DailyRet - mean(Hist_Port_DailyRet); [h3,p3] = lbqtest(Portfolio_Residual); if h3==1 h3_String='Reject with 95% Confidence'; else h3_String='Fail to reject with 95% Confidence'; end Index_Residual = HSI_Index_Ret(1:988,1) - mean(HSI_Index_Ret(1:988,1)); [h4,p4] = lbqtest(Index_Residual); if h4==1 h4_String='Reject with 95% Confidence'; else h4_String='Fail to reject with 95% Confidence'; end % b) ACF and PACF plots: figure subplot(2,2,1) autocorr(Hist_Port_DailyRet) title('ACF of Optimized Portfolio Daily Returns 2004-2007') str3 = {'Ljung-Box Q-test p-value: ' ,num2str(p3),... 'Null Hypothesis of no Autocorrelation: ',h3_String}; annotation('textbox', [0.3,0.745,0.125,0.16],'String', str3, 'color','b');
22 | P a g e
Portfolio Risk Analysis
subplot(2,2,2) parcorr(Hist_Port_DailyRet) title('PACF of Optimized Portfolio Daily Returns 2004-2007') subplot(2,2,3) autocorr(HSI_Index_Ret(1:988,1)) title('ACF of Hang Seng Index Daily Returns 2004-2007') str4 = {'Ljung-Box Q-test p-value: ' ,num2str(p4),... 'Null Hypothesis of no Autocorrelation: ',h4_String}; annotation('textbox', [0.3,0.27,0.125,0.16],'String', str4, 'color','b'); subplot(2,2,4) parcorr(HSI_Index_Ret(1:988,1)) title('PACF of Hang Seng Index Daily Returns 2004-2007') % Result of iii): % Reject Null Hypothesis that both "Hang Seng Index" and "Min Variance % Portfolio are not autocorrelated with 95% confidence %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % iv) Test for Stationarity % Dickey-Fuller test for stationarity h5 = adftest(Hist_Port_DailyRet); h6 = adftest(HSI_Index_Ret(1:988,1)); % KPSS test for stationarity h7 = kpsstest(Hist_Port_DailyRet); h8 = kpsstest(diff(HSI_Index_Ret(1:988,1))); % Result of iv): Reject the null hypothesis of a unit root % for both Hang Seng Index and Optimised Portfolio Returns with 95% % confidence. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 6) Estimate Systematic Normal and Student t Linear VaR on Hang Seng Index % and Minimum Variance Portfolio: Alpha=0.01; % Significance Level: as specified by Basel II % i) Hang Seng Index Systematic Normal Linear 1-day 1% VaR VaR_HSI_NormLinear_1day = norminv((1-Alpha))*std(HSI_Index_Ret(1:988,1)); % Hang Seng Index Systematic Normal Linear 1-day 1% ETL % (Eqn: Ref. Alecander, C. Vol.4 pg 129) ETL_HSI_NormLinear_1day = (normpdf(norminv(Alpha,0,1))... *std(HSI_Index_Ret(1:988,1)))/Alpha; % ii) Minimum Variance Normal Linear 1-day 1% VaR VaR_Port_NormLinear_1day = norminv((1-Alpha))*Portfolio_Exp_SD; % Minimum Variance Normal Linear 1-day 1% ETL ETL_Port_NormLinear_1day = (normpdf(norminv(Alpha,0,1))... *Portfolio_Exp_SD)/Alpha; % iii) HSI Index Systematic Student-t 1-day 1% VaR %Degrees of Freedom parameter estimated by fitting distribution using MLE V1=mle(HSI_Index_Ret(1:988,:),'distribution','tlocationscale'); VaR_HSI_StudentT_1day=sqrt((V1(3)-2)/V1(3))*tinv(1-Alpha,V1(3))*... std(HSI_Index_Ret(1:988,1)); % HSI Index Systematic Student-t 1-day 1% ETL % (Eqn: Ref. Alecander, C., Vol.4 pg 130) ETL_HSI_StudentT_1day=((V1(3)- 2 +tinv(Alpha,V1(3))^2)* ... tpdf(tinv(Alpha,V1(3)),V1(3))*std(HSI_Index_Ret(1:988,1)))/... (Alpha*(V1(3)-1)); % iv) Minimum Variance Systematic Student-t 1-day 1% VaR %Degrees of Freedom parameter estimated by fitting distribution using MLE V2=mle(Hist_Port_DailyRet,'distribution','tlocationscale'); VaR_Portfolio_StudentT_1day=sqrt((V2(3)-2)/V2(3))*tinv(1-Alpha,V2(3))...
23 | P a g e
Portfolio Risk Analysis
*Portfolio_Exp_SD; % Minimum Variance Systematic Student-t 1-day 1% ETL ETL_Portfolio_StudentT_1day=((V2(3)- 2 +tinv(Alpha,V2(3))^2)* ... tpdf(tinv(Alpha,V2(3)),V2(3))*Portfolio_Exp_SD)/... (Alpha*(V2(3)-1)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 7) GPD VaR: %i) Hang Seng Index GPD VaR: NormalisedRet_HSI=(HSI_Index_Ret(1:988,1)-mean(HSI_Index_Ret(1:988,1)))/... std(HSI_Index_Ret(1:988,1)); % Normalised Returns: Mean=0, Variance=1 %set threshold u=15% u_15perc_HSI=prctile(NormalisedRet_HSI,15); ThresholdU1=NormalisedRet_HSI(NormalisedRet_HSI<u_15perc_HSI); % Maximum Likelihood Parameters for GPD Parameters GPD_HSI_Param = gpfit(abs(ThresholdU1)); VaR_HSI_GPDNorm_1day = u_15perc_HSI+(GPD_HSI_Param(2)/(GPD_HSI_Param(1)*... (length(NormalisedRet_HSI))^GPD_HSI_Param(1)))*((length(ThresholdU1)... /(1-Alpha))^GPD_HSI_Param(1) - length(NormalisedRet_HSI)... ^GPD_HSI_Param(1)); % De-normalise VaR Estimate VaR_HSI_GPD_1day=VaR_HSI_GPDNorm_1day* std(HSI_Index_Ret(1:988,1))+... mean(HSI_Index_Ret(1:988,1)); % Hang Seng Index GPD ETL: ETL_HSI_GPDNorm_1day = VaR_HSI_GPDNorm_1day+(GPD_HSI_Param(2)... -GPD_HSI_Param(1)*(VaR_HSI_GPDNorm_1day))... /(1-GPD_HSI_Param(1)); % De-normalise ETL Estimate ETL_HSI_GPD_1day=ETL_HSI_GPDNorm_1day* std(HSI_Index_Ret(1:988,1))+... mean(HSI_Index_Ret(1:988,1)); %ii) Minimum Variance Portfolio GPD VaR: %set threshold u=15% NormalisedRet_Port=(Hist_Port_DailyRet(:)-mean(Hist_Port_DailyRet))/... std(Hist_Port_DailyRet); % Normalised Returns: Mean=0, Variance=1 u_15perc_Port=prctile(NormalisedRet_Port,15); ThresholdU2=NormalisedRet_Port(NormalisedRet_Port<u_15perc_Port); % Maximum Likelihood Parameters for GPD Parameters GPD_Port_Param = gpfit(abs(ThresholdU2)); VaR_Port_GPDNorm_1day = u_15perc_Port+(GPD_Port_Param(2)/(GPD_Port_Param(1)*... (length(Hist_Port_DailyRet))^GPD_Port_Param(1)))*((length(ThresholdU2)... /(1-Alpha))^GPD_Port_Param(1) - length(Hist_Port_DailyRet)... ^GPD_Port_Param(1)); % De-normalise VaR Estimate VaR_Port_GPD_1day=VaR_Port_GPDNorm_1day* std(Hist_Port_DailyRet)+... mean(Hist_Port_DailyRet); % Minimum Variance Portfolio GPD ETL: ETL_Port_GPDNorm_1day = VaR_Port_GPDNorm_1day+(GPD_Port_Param(2)... -GPD_Port_Param(1)*(VaR_Port_GPDNorm_1day))... /(1-GPD_Port_Param(1)); % De-normalise ETL Estimate ETL_Port_GPD_1day=ETL_Port_GPDNorm_1day* std(Hist_Port_DailyRet)+... mean(Hist_Port_DailyRet); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 7) Bernoulli VaR In-Sample Backtesting: % Test VaR Models over 2008 period and most accurate VaR model Test_Period=length(HSI_Index_Ret); Estimation_Window=Test_Period-245;
24 | P a g e
Portfolio Risk Analysis
% i) Hang Seng Index Systematic Normal Linear 1-day 1% VaR VaR_HSI_NormLinear_2008TS=zeros(Test_Period,1); for t= Estimation_Window+1:Test_Period; t1=t-Estimation_Window; t2=t-1; Window=(HSI_Index_Ret(t1:t2)); VaR_HSI_NormLinear_2008TS(t)=norminv(1-Alpha)*std(Window); end % Points where daily returns exceeds daily 1% VaR Estimate Bernoulli_Exceed_Point1=find(HSI_Index_Ret(Estimation_Window+1:... Test_Period)<-VaR_HSI_NormLinear_2008TS(Estimation_Window+1:... Test_Period)); Bernoulli_Exceed_Returns1=NaN(245,1); Bernoulli_Exceed_Returns1(Bernoulli_Exceed_Point1)=HSI_Index_Ret... (Bernoulli_Exceed_Point1+Estimation_Window); % Bernoulli Exceedance Counting formula Exceedance_HSI_NL=length(Bernoulli_Exceed_Point1); % Kupiec’s (1995) unconditional coverage test n=Test_Period-Estimation_Window; n1=Exceedance_HSI_NL; n0=n-n1; MUexpected=Alpha; MUobserved=n1/n; LR1= ((MUexpected^n1)*((1-MUexpected)^n0))/((MUobserved^n1)*... ((1-MUobserved)^n0)); %Likelihood Ratio if -2*log(LR1)>6.6349 Kupiec1 = 1;% Reject, at 1% Confidence level, null hypothesis of a % constant "success" probapility equal to Alpha else Kupiec1 = 0; % Fail to reject Null Hypothesis end % ii) Hang Seng Index Systematic Student-t Linear 1-day 1% VaR VaR_HSI_StudentT_2008TS=zeros(Test_Period,1); for t= Estimation_Window+1:Test_Period; t1=t-Estimation_Window; t2=t-1; Window=(HSI_Index_Ret(t1:t2)); VaR_HSI_StudentT_2008TS(t)=sqrt((V1(3)-2)/V1(3))*tinv(1-Alpha,V1(3))*... std(Window); end Bernoulli_Exceed_Point2=find(HSI_Index_Ret(Estimation_Window+1:... Test_Period)<-VaR_HSI_StudentT_2008TS(Estimation_Window+1:... Test_Period)); Bernoulli_Exceed_Returns2=NaN(245,1); Bernoulli_Exceed_Returns2(Bernoulli_Exceed_Point2)=HSI_Index_Ret... (Bernoulli_Exceed_Point2+Estimation_Window); % Bernoulli Exceedance Counting formula Exceedance_HSI_ST=length(Bernoulli_Exceed_Point2); % Kupiec’s (1995) unconditional coverage test n=Test_Period-Estimation_Window; n1=Exceedance_HSI_ST; n0=n-n1; MUexpected=Alpha; MUobserved=n1/n; LR2= ((MUexpected^n1)*((1-MUexpected)^n0))/((MUobserved^n1)*... ((1-MUobserved)^n0)); %Likelihood Ratio if -2*log(LR2)>6.6349 Kupiec2 = 1;% Reject, at 1% Confidence level, null hypothesis of a % constant "success" probapility equal to Alpha else Kupiec2 = 0; % Fail to reject Null Hypothesis end
25 | P a g e
Portfolio Risk Analysis
% iii) Hang Seng Index GPD 1-day 1% VaR,threshold=15% VaR_HSI_GPD_2008TS=zeros(Test_Period,1); for t= Estimation_Window+1:Test_Period; t1=t-Estimation_Window; t2=t-1; Window=(HSI_Index_Ret(t1:t2,1)-mean(HSI_Index_Ret(t1:t2,1)))/... std(HSI_Index_Ret(t1:t2,1)); u_15perc_HSI=prctile(Window,15); ThresholdU=Window(Window<u_15perc_HSI); GPD_HSI_Param = gpfit(abs(ThresholdU)); VaR_HSI_GPDNorm_2008TS=u_15perc_HSI+(GPD_HSI_Param(2)/(GPD_HSI_Param(1)*... (length(Window))^GPD_HSI_Param(1)))*((length(ThresholdU)... /(1-Alpha))^GPD_HSI_Param(1) - length(Window)... ^GPD_HSI_Param(1)); VaR_HSI_GPD_2008TS(t)=VaR_HSI_GPDNorm_2008TS*... std(HSI_Index_Ret(t1:t2,1))+mean(HSI_Index_Ret(t1:t2,1)); end % Points where daily returns exceeds daily 1% VaR Estimate Bernoulli_Exceed_Point3=find(HSI_Index_Ret(Estimation_Window+1:... Test_Period)<VaR_HSI_GPD_2008TS(Estimation_Window+1:... Test_Period)); Bernoulli_Exceed_Returns3=NaN(245,1); Bernoulli_Exceed_Returns3(Bernoulli_Exceed_Point3)=HSI_Index_Ret... (Bernoulli_Exceed_Point3+Estimation_Window); % Bernoulli Exceedance Counting formula Exceedance_HSI_GPD=length(Bernoulli_Exceed_Point3); % Kupiec’s (1995) unconditional coverage test n=Test_Period-Estimation_Window; n1=Exceedance_HSI_GPD; n0=n-n1; MUexpected=Alpha; MUobserved=n1/n; LR3= ((MUexpected^n1)*((1-MUexpected)^n0))/((MUobserved^n1)*... ((1-MUobserved)^n0)); %Likelihood Ratio if -2*log(LR3)>6.6349 Kupiec3 = 1;% Reject, at 1% Confidence level, null hypothesis of a % constant "success" probapility equal to Alpha else Kupiec3 = 0; % Fail to reject Null Hypothesis end % Plot results of Bernoulli exceedance backtest figure plot(HSI_Index_Ret(Estimation_Window+1:Test_Period)) hold on plot(-VaR_HSI_NormLinear_2008TS(Estimation_Window+1:Test_Period),'--r') plot(-VaR_HSI_StudentT_2008TS(Estimation_Window+1:Test_Period),'--g') plot(VaR_HSI_GPD_2008TS(Estimation_Window+1:Test_Period),'--m') plot(Bernoulli_Exceed_Returns1,'rv','MarkerSize',10) hold on plot(Bernoulli_Exceed_Returns2,'g^','MarkerSize',10) hold on plot(Bernoulli_Exceed_Returns3,'m+','MarkerSize',20) title('1% Daily Normal Linear VaR, Student-t Linear and GPD VaR vs. Daily Returns of HSI 2008') legend('HSI Daily Returns','HSI Daily 1% Normal Linear VaR',... 'HSI Daily 1% Student-t Linear VaR','HSI Daily 1% GPD VaR',... 'Normal Linear VaR Exceedance','Student-t Linear VaR Exceedance', ... 'GPD VaR Exceedance') str3 = {'Number of Normal Linear VaR Exceedances : ' ... ,num2str(Exceedance_HSI_NL),'Number of Student-t Linear VaR Exceedances :'... ,num2str(Exceedance_HSI_ST),'Number of GPD VaR Exceedances :'... ,num2str(Exceedance_HSI_GPD)}; annotation('textbox', [0.2,0.15,0.15,0.24],'String', str3); % iv) Minimum Variance Portfolio Systematic Normal Linear 1-day 1% VaR Sample_Port_DailyRet = (PortfolioWeights'*HSI_Share_Ret(:,:)')'; VaR_Port_NormLinear_2008TS=zeros(Test_Period,1);
26 | P a g e
Portfolio Risk Analysis
for t= Estimation_Window+1:Test_Period; t1=t-Estimation_Window; t2=t-1; Portfolio_SD = sqrt(PortfolioWeights'*cov(HSI_Share_Ret(t1:t2,:))... *PortfolioWeights); VaR_Port_NormLinear_2008TS(t)=norminv(1-Alpha)*Portfolio_SD; end % Points where daily returns exceeds daily 1% VaR Estimate Bernoulli_Exceed_Point4=find(Sample_Port_DailyRet(Estimation_Window+1:... Test_Period)<-VaR_Port_NormLinear_2008TS(Estimation_Window+1:... Test_Period)); Bernoulli_Exceed_Returns4=NaN(245,1); Bernoulli_Exceed_Returns4(Bernoulli_Exceed_Point4)=Sample_Port_DailyRet... (Bernoulli_Exceed_Point4+Estimation_Window); % Bernoulli Exceedance Counting formula Exceedance_Port_NL=length(Bernoulli_Exceed_Point4); % Kupiec’s (1995) unconditional coverage test n=Test_Period-Estimation_Window; n1=Exceedance_Port_NL; n0=n-n1; MUexpected=Alpha; MUobserved=n1/n; LR4= ((MUexpected^n1)*((1-MUexpected)^n0))/((MUobserved^n1)*... ((1-MUobserved)^n0)); %Likelihood Ratio if -2*log(LR4)>6.6349 Kupiec4 = 1;% Reject, at 1% Confidence level, null hypothesis of a % constant "success" probapility equal to Alpha else Kupiec4 = 0; % Fail to reject Null Hypothesis end % v) Minimum Variance Portfolio Systematic Student-t Linear 1-day 1% VaR VaR_Port_StudentT_2008TS=zeros(Test_Period,1); for t= Estimation_Window+1:Test_Period; t1=t-Estimation_Window; t2=t-1; Portfolio_SD = sqrt(PortfolioWeights'*cov(HSI_Share_Ret(t1:t2,:))... *PortfolioWeights); VaR_Port_StudentT_2008TS(t)=sqrt((V2(3)-2)/V2(3))*tinv(1-Alpha,V1(3))*... Portfolio_SD; end % Points where Portfolio daily returns exceeds daily 1% VaR Estimate Bernoulli_Exceed_Point5=find(Sample_Port_DailyRet(Estimation_Window+1:... Test_Period)<-VaR_Port_StudentT_2008TS(Estimation_Window+1:... Test_Period)); Bernoulli_Exceed_Returns5=NaN(245,1); Bernoulli_Exceed_Returns5(Bernoulli_Exceed_Point5)=... Sample_Port_DailyRet(Bernoulli_Exceed_Point5+Estimation_Window); % Bernoulli Exceedance Counting formula Exceedance_Port_ST=length(Bernoulli_Exceed_Point5); % Kupiec’s (1995) unconditional coverage test n=Test_Period-Estimation_Window; n1=Exceedance_Port_ST; n0=n-n1; MUexpected=Alpha; MUobserved=n1/n; LR5= ((MUexpected^n1)*((1-MUexpected)^n0))/((MUobserved^n1)*... ((1-MUobserved)^n0)); %Likelihood Ratio if -2*log(LR5)>6.6349 Kupiec5 = 1;% Reject, at 1% Confidence level, null hypothesis of a % constant "success" probapility equal to Alpha else Kupiec5 = 0; % Fail to reject Null Hypothesis end % vi) Minimum Variance Portfolio GPD 1-day 1% VaR,threshold=15%
27 | P a g e
Portfolio Risk Analysis
VaR_Port_GPD_2008TS=zeros(Test_Period,1); %set threshold u=15% for t= Estimation_Window+1:Test_Period; t1=t-Estimation_Window; t2=t-1; Window1=(PortfolioWeights'*HSI_Share_Ret(t1:t2,:)')'; % Normalise Returns over Estimation Window Window2=(Window1(:)-mean(Window1))/std(Window1); u_15perc_Port=prctile(Window2,15); ThresholdU=Window2(Window2<u_15perc_Port); GPD_Port_Param = gpfit(abs(ThresholdU)); VaR_Port_GPDNorm_2008TS=u_15perc_Port+(GPD_Port_Param(2)/... (GPD_Port_Param(1)*(length(Window2))^GPD_Port_Param(1)))*... ((length(ThresholdU)/(1-Alpha))^GPD_Port_Param(1) - length(Window2)... ^GPD_Port_Param(1)); VaR_Port_GPD_2008TS(t)=VaR_Port_GPDNorm_2008TS* std(Window1)+... mean(Window1); end % Points where daily returns exceeds daily 1% VaR Estimate Bernoulli_Exceed_Point6=find(Sample_Port_DailyRet(Estimation_Window+1:... Test_Period)<VaR_Port_GPD_2008TS(Estimation_Window+1:... Test_Period)); Bernoulli_Exceed_Returns6=NaN(245,1); Bernoulli_Exceed_Returns6(Bernoulli_Exceed_Point6)=Sample_Port_DailyRet... (Bernoulli_Exceed_Point6+Estimation_Window); % Bernoulli Exceedance Counting formula Exceedance_Port_GPD=length(Bernoulli_Exceed_Point6); % Kupiec’s (1995) unconditional coverage test n=Test_Period-Estimation_Window; n1=Exceedance_Port_GPD; n0=n-n1; MUexpected=Alpha; MUobserved=n1/n; LR6= ((MUexpected^n1)*((1-MUexpected)^n0))/((MUobserved^n1)*... ((1-MUobserved)^n0)); %Likelihood Ratio if -2*log(LR6)>6.6349 Kupiec6 = 1;% Reject, at 1% Confidence level, null hypothesis of a % constant "success" probapility equal to Alpha else Kupiec6 = 0; % Fail to reject Null Hypothesis end % Plot results of Bernoulli exceedance backtest figure plot(Sample_Port_DailyRet(Estimation_Window+1:Test_Period)) hold on plot(-VaR_Port_NormLinear_2008TS(Estimation_Window+1:Test_Period),'--r') plot(-VaR_Port_StudentT_2008TS(Estimation_Window+1:Test_Period),'--g') plot(VaR_Port_GPD_2008TS(Estimation_Window+1:Test_Period),'--m') plot(Bernoulli_Exceed_Returns4,'rv','MarkerSize',10) hold on plot(Bernoulli_Exceed_Returns5,'g^','MarkerSize',10) hold on hold on plot(Bernoulli_Exceed_Returns6,'m+','MarkerSize',20) title('1% Daily Normal Linear VaR, Student-t Linear and GPD VaR vs. Daily Returns of Minimum Variance Portfolio 2008') legend('Port Daily Returns','Port Daily 1% Normal Linear VaR',... 'Port Daily 1% Student-t Linear VaR','Port Daily 1% GPD VaR',... 'Normal Linear VaR Exceedance','Student-t Linear VaR Exceedance', ... 'GPD VaR Exceedance') str4 = {'Number of Normal Linear VaR Exceedances : ' ... ,num2str(Exceedance_Port_NL),'Number of Student-t Linear VaR Exceedances :'... ,num2str(Exceedance_Port_ST),'Number of GPD VaR Exceedances :'... ,num2str(Exceedance_Port_GPD)}; annotation('textbox', [0.2,0.15,0.15,0.24],'String', str4);
28 | P a g e
Portfolio Risk Analysis
Covariance Matrix is Symmetric Covariance Matrix is Positive Definite Warning: P is less than the smallest tabulated value, returning 0.001. Warning: P is less than the smallest tabulated value, returning 0.001. Warning: Maximum likelihood has converged to an estimate of K < -1/2. Confidence intervals and standard errors can not be computed reliably. Warning: Maximum likelihood has converged to an estimate of K < -1/2. Confidence intervals and standard errors can not be computed reliably. Warning: Maximum likelihood has converged to an estimate of K < -1/2.
-0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03 0.040
20
40
60
80
100
120
140Histogram of Optimized Portfolio Daily Returns 2004-2007
Optimized Portfolio Daily Returns
Fre
quency
-0.06 -0.04 -0.02 0 0.02 0.04 0.060
20
40
60
80
100
120
140
160
180
200Histogram of Hang Seng Index Daily Returns 2004-2007
Hang Seng Index Daily Returns
Fre
quency
Mean
Return:
0.00078535
Excess
Kurtosis:
1.8595
Skewness:
-0.26298
Mean
Return
0.00078535
Excess
Kurtosis:
2.7252
Skewness:
-0.16533
29 | P a g e
Portfolio Risk Analysis
30 | P a g e
Portfolio Risk Analysis
Published with MATLAB® 7.14