Você está na página 1de 26

Value at Risk

Cherif El Hassane DIOP, Erhan DINCER, Meryem DOUHOUR


Master 1 Ingnierie des Risques
Institut des Sciences Financires et dAssurance

Directed by Mrs JIAO YING University Research professor

ISFA
50 avenue Tony Garnier
69366 Lyon CEDEX 7

Abstract
Value at Risk is one of the most popular tools used to estimate exposure to market risks, and it
measures the worst expected loss at a given confidence level. In this report, we explain the concept
of VaR, and then describe in detail some methods of VaR computation. We then discuss some
VaR tools that are particulary useful for risk management. Finally, we introduce some Simulations
of different methods to validate the use of VaR model. Some methodological limitations are quite
fundamental: for example, the VaR is not interested in extreme values beyond the threshold of
confidence. Portfolios with the same VaR can generate very different extreme losses that VaR does
not provide information (for this its important to analyze VaR). How to complete the calculated
VaR to evaluate the financial stability?

Thanks
We would like to begin by thanking Mrs JIAO YING for her availability and her valuable advice.

Engagement de non plagiat


Nous dclarons tre pleinement conscient(e)s que le plagiat de documents ou dune partie dun
document publis sur toutes formes de support, y compris sur Internet, constitue une violation des
droits dauteur ainsi quune fraude caractrise.
En consquence, nous nous engageons citer toutes les sources que nous avons utilises pour
crire ce rapport. Nous nous engageons en particulier citer ces sources dans la bibliographie, ainsi
que dans le corps du texte, au moment des emprunts.
Erhan DINCER
Cherif El Hassane DIOP
Meryem DOUHOUR

Summary
Abstract

Thanks

Engagement de non plagiat

Introduction

1 The Value-at-Risk
1.1 Historical . . . . . . . . . . . . . .
1.1.1 JP MORGAN . . . . . . . .
1.1.2 THE BASEL . . . . . . . .
1.2 Value at Risk . . . . . . . . . . . .
1.2.1 The mathematical definition
1.2.2 VaR features . . . . . . . .
1.3 The VaR limits . . . . . . . . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

7
7
7
7
7
7
9
9

2 Methods to measure VaR


2.1 Historical Simulation . . . . . . . . . . . . . . . . .
2.1.1 Illustration . . . . . . . . . . . . . . . . . .
2.1.2 Advantages and Disadvantages . . . . . . .
2.2 Parametric Modeling:Variance-Covariance Method
2.2.1 Advantages and Disavantages . . . . . . . .
2.3 Monte Carlo Simulation . . . . . . . . . . . . . . .
2.3.1 Advantages and Disadvantages . . . . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

10
10
11
12
12
14
14
16

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

3 Case study: MonteCarlo VaR for a portofolio of two assets

17

Conclusion

19

4 Annex

19

Bibliography

26

Introduction
The idea of integrating value management and risk management has started more than ten years
ago as many professionals realized that it is impossible to separate between value and risk. Value
management is about articulating what represents value in terms of project benefits while risk
management is about identifying causes of uncertainty and what can go wrong. Both activities
complement each other. Value management can reduce risk and risk management provides opportunities to increase value.
Extreme events are central in finance, particularly in the field of financial risk management. Frequency of financial crises has revealed the extent of the financial risk, volatility and interdependence
of stock markets. To understand and prevent these attacks, it is necessary to develop new measures
of risk and redefine risk factors and international interdependencies. Thus, extreme events require
modeling and further analysis because the significant losses that result can ruin the most profitable
investment funds. The study of addiction is therefore essential to select the portfolio that is less
vulnerable to losses.
The VAR is a statistical technique used to measure and quantify the level of financial risk within
a firm or investment portfolio over a specific time frame. Value at risk is used by risk managers in
order to measure and control the level of risk which the firm undertakes. The risk managers job
is to ensure that risks are not taken beyond the level at which the firm can absorb the losses of a
probable worst outcome.
The project objective is to develop a solution for calculating VaR to give statistical results dimension. At first, we will focus on familiarization with the notion of Value at Risk: history,definition
. In a second phase, the project will focus on the implementation of existing methods solutions.
The interest of the project is to become familiar with the implementation of the VaR by MonteCarlo techniques and others methods.

The Value-at-Risk

1.1
1.1.1

Historical
JP MORGAN

Used for the first time in the 1980s by the bank BANKERS TRUST on U.S. financial markets, the
concept of Value-At-Risk (or VAR) has mainly been democratized by the JP Morgan bank in the
1990s thanks to its Risk Metrics.
Previously, the methods used to detect and manage market risk was not possible to compare
the measures of risk between the different market activities. The increased volatility in financial
markets, the development of products and especially a series of bankruptcies and market crashes led
financial institutions to establish a common and synthetic indicator of financial risks. In 1993, JP
Morgan introduced a new measure of risk: Value at Risk (VaR). This allows to assess the downside
risk of VBI. It is the amount of losses that should not be exceeded with a given time horizon on a
given probability.
The VaR has become unavoidable in 1997, through the Basel II, since it is this measure that
the Committee recommends to measure market risk.
1.1.2

THE BASEL

To improve the stability and strengthen the international banking system , leaders of major central
banks established in 1974 the Basel Committee on Banking Supervision spent .This committee,
composed of central banks and regulators of the major industrialized countries, meets at the Bank
for International Settlements (BIS ) in Basel. It is primarily responsible for establishing standards
and guidelines to help banks in their risk management.
Having found a significant proportion of bank failures was due to mismanagement of the principle
of risk diversification, the Committee has prepared a set of recommendations released in 1988.
Known as Basel 1988 (or Basel I), this document sets a minimum amount of capital that banks
must have. This quantity is defined by the Cooke ratio: the ratio of own funds of a credit institution
in relation to all credit commitments at this property cannot be less than 8 %. More practically,
this ratio provides for 100 euros invested in the market, the bank must have 8 euros in equity. One
of the main shortcomings of the Basel I is the fact that it does not take into account the quality
of the borrower, and therefore credit risk it represents. To overcome this problem , the Committee
proposed in 2004 a new set of recommendations, which the Cooke ratio leaves room McDonough
ratio , thinner , defined as such own funds of a credit institution may not be less than 8 % of (credit
risk (85 %) + market risk (5 %) + operational risk (10%).
It is in this new document, called the New Basel Accord or Basel II, the Committee sets the
Value at Risk as a method of measuring market risk.
Specifically, it recommends the use of a 10-day VaR with a confidence interval of 99 %. In summary, the Basel II rests on three pillars: minimum capital requirement equity ( ratio of McDonough
) , monitoring by supervisors , and market discipline.

1.2
1.2.1

Value at Risk
The mathematical definition

Value at Risk (VaR) is a measure used to quantify the market risk of a portfolio of financial
instruments. This measures the maximum potential loss on a position, a threshold (probability)
fixed on a given time horizon (day, week, month). VaR answers the following statement:

Figure 1: Pillars of Basel

Figure 2: Var 90 %

"We are confident, X %, we will not lose more than V euros over the next N days".
V aR(X, ) = x
where
P (X x ) =
The use of VaR is now no longer limited to financial instruments: we can make a risk management
tool in all areas.
Here for example is an illustration of the Value at Risk 90 % on one day, with a portfolio
following a normal distribution:
VaR of a portfolio depends on three parameters:
The distribution of portfolio performance: most of the time, this distribution is assumed to
be normal.
The chosen confidence level (95 % or 99 % overall). This is the probability of potential losses
in the portfolio or asset not exceeding the VaR.
The time horizon chosen. This parameter is very important because the more the horizon is
longer, the losses can besignificant. For a normal distribution of returns, simply multiply the
Value at Risk at a day N for the Value at Risk of N days.

Generally, VaR provides an estimate of losses that should not be exceeded except extreme event
on a portfolio can be composed of different asset classes.
1.2.2

VaR features

Lets look in more detail the parameters of the VaR presented earlier:
confidence level
It is a measure of the reliability of a result. A confidence level of 95 per cent or 0.95 means that
there is a probability of at least 95 per cent that the result is reliable. It is influenced by two factors:
It should reflect the degree of aversion to risk managers face in achieving extreme events.
It should not be too high, otherwise the risk of realization is low enough to be uninteresting
as an indicator.
horizon
It is in turn influenced by three factors:
It must be adapted to the holding period of the asset or portfolio subject of the estimate
It should be short enough for the amount of data available can allow to estimate VaR on the
horizon.
It should be short enough to meet the invariance of the portfolio composition hypothesis.
Note that the confidence level and horizon are sometimes set by regulatory standards. Thus, the
Basel Committee has recommended in the Basel II using a VaR at 99% over 10 days to measure
market risk.
In order to calculate the VaR of a portfolio, it is necessary to make a number of assumptions. A
conventional assumption is that the average return on assets is zero for the period concerned. As the
time horizon generally does not exceed 10 days, this assumption is not restrictive. For example, if
we expect an average annual return of 20 % for some action, this represents an average daily yield of
20/252 % (with 252 corresponding to the number of working days in a year) which is approximately
0.08 %. Assuming that the daily output is zero is therefore not a restrictive assumption.
The second assumption that is usually made is that VaR N days is equal to the square root of
N times the VaR one day. This result is true if one assumes that the returns of the various assets
in the portfolio which are normally distributed random variables. This rule, called "scaling law" is
accepted by the Basel Committee although it is often criticized because it underestimates the true
risk.

1.3

The VaR limits

We have seen that the Value at Risk could be considered the potential loss maximum of a portfolio.
However, its assessment is based on inaccuracies sometimes more or less important that can influence
the final result.
The first limitation is the assumption of normality of changes in prices of various assets.
Indeed, the normal distribution often underestimates the large variations in market and thus
neglects long tails of distributions.

The second limitation concerns the reliability of the results obtained when to anticipate the
evolution of an asset in a more or less near future, using its past evolution. calculation of
Value at Risk requires a fixed horizon. This means that we consider sufficiently liquid walked
to that we can sell all our assets on the horizon chosen.
Finally, the last VaR limit is that approximations and simulations we use a lot. And despite
the growing power of machinery, will fast implementation requires the use of approximations.
Aware of the limitations posed by the different VaR models, back-testing and stress testing have
been made mandatory to verify the results. System back-testing is to determine the number of
times the loss obtained was greater than the VAR. If this number is too large, it is necessary to
review the model used for the calculation.
Along with these back-testing, the Basel Committee also places stress tests during which the
portfolio will be subject to extreme market conditions (eg change of 100 basis points higher or lower
rates, sudden 20 % increase in volatility ...) to examine their behavior in response to highly negative
scenarios.

Methods to measure VaR

There are three common methods of calculating VAR:


historical method,
parametric modeling
Monte Carlo simulation.
These methodologies are both advantages and disvantages.

2.1

Historical Simulation

One of the most common methods for VaR estimation is the Historical Simulation.It is the most
popular method for VaR calculation in the banking industry This approach drastically simplifies
the procedure for computing the Value at Risk, since it doesnt make any distributional assumption
about portfolio returns. Historical Simulation is based on the concept of rolling windows. First, one
needs to choose a window of observations, that generally ranges from 6 months to two years. But to
have pertinent data, we have to chose a window of more than 250 days. Then, portfolio returns(gains
or losses) within this window are sorted in ascending order and the -quantile of interest is given by
the return that leaves % of the observations on its left side and (1-)% on its right side. If such a
number falls between two consecutive returns, then some interpolation rule is applied. To compute
the VaR the following day, the whole window is moved forward by one observation and the entire
procedure is repeated.
This method accurately prices all types of complex non-linear positions as well as simple linear
instruments. It also provides a full distribution of potential portfolio gains and losses (which need
not be symmetrical). If the underlying risk factors exhibit non-normal behavior such as fat-tails or
mean reversion, then the resulting VaR will include these effects. However, tail risk can only be
examined if the historical data set includes tail events. In fact this method pretends that market
changes are similar to those observed in the past.

10

Figure 3: Data Michelin

Figure 4: Returns

2.1.1

Illustration

We consider 500 daily action data Michelin (see fig 3). We are interested in opening and closing daily
values. Each day, the return is calculated (see fig 4). Then these returns are sorted in ascending
order (see fig 5). Historical VaR is determined by considering a particular value returns sorted
according to confidence interval. So
V aR(95%1d) = 1.75
V aR(99%, 1d) = 2.18
To know the index that we have to use, we make this calculus 500 (100-confidence level). The
value of this index is the VaR.

11

Figure 5: Sorted Returns

2.1.2

Advantages and Disadvantages

The main advantage of this method is that, its very easy to compute. No needs of much calculations
and assumption of the distribution form. Techniques used are relatively simple.
However, we have some limits for the use of historical simulation. Its not available for derivatives.
Besides, the side of the window have to be much longer than the horizon, but not so much, if not
distribution may change.

2.2

Parametric Modeling:Variance-Covariance Method

Analytical VaR is also called Parametric VaR because one of its fundamental assumptions is that
the return distribution belongs to a family of parametric distributions such as the normal or the
lognormal distributions. Specifically, it applies to portfolios of cash, futures and/or forward positions
on commodities, bonds, loans, swaps, equities and foreign exchange.
VaR of a Single Asset
VaR of a single asset is the value of the asset multiplied by its volatility. Here, the volatility can
be calculated at the desired confidence level.
V AR1 = P Z P
where:
V aR1 is the estimated VaR at the confidence level 100 (1 )%.
Z represents the no. of standard deviations on the left side of the mean, at the required
standard deviation. Z is described in the expression where R is the expected return. In
order for VaR to be meaningful, we generally choose a confidence level of 95% or 99%.
P is the marked-to-market value of the asset.

12

VaR of Portfolio of 2 assets


Generally VaR will not be calculated for a single position, but a portfolio of positions. The VaR
will then be given by:
q
V aR1 = V aR12 + V aR22 + 2 V aR1 V aR2
Where:
V aR1 is the VaR of the first asset
V aR2 is the VaR of the second asset
is the correlation coefficient between the two assets
Example Let us assume that we want to calculate Parametric VaR at 99% confidence level over
one-day horizon on a portfolio composed of two assets with the following assumptions:
P1 = 5 billion
P2 = 10 billion
= 0.5
The VaR at 99 % for one day is :
V aR1 (99%, 1d) = 5000000 2.33 2% = 234842
V aR2 (99%, 1d) = 10000000 2.33 1.5% = 352263
V aR99%,1d =

p
2348422 + 3522632 2 0.5 234842 325263 = 511826

This means that there is a 1% chance that this portfolio may lose at least 511826 at the end of the
next trading day under normal market conditions.
Portfolio of n assets
If the portfolio is bigger than 2 assets, the VaR of the portfolio is expressed using matrix notation:
v

u
u
1 1n
V aR1
u
.
.. ..
..
V aRP = u
.
. .
t(V aR1 , . . . , V aRn ) ..
n1

Where:
ij is the correlation coefficient between the asset i and j
V aRj is the VaR of asset j

13

V aRn

2.2.1

Advantages and Disavantages

Analytical VaR is the simplest methodology to compute VaR and is rather easy to implement for a
fund. The input data is rather limited, and since there are no simulations involved, the computation
time is minimal.
Its simplicity is also its main drawback. First, Analytical VaR assumes not only that the
historical returns follow a normal distribution, but also that the changes in price of the assets
included in the portfolio follow a normal distribution. And this very rarely survives the test of
reality. Second, Analytical VaR does not cope very well with securities that have a non-linear payoff
distribution like options or mortgage-backed securities. Finally, if our historical series exhibits heavy
tails, then computing Analytical VaR using a normal distribution will underestimate VaR at high
confidence levels and overestimate VaR at low confidence levels.

2.3

Monte Carlo Simulation

Monte Carlo simulation is an extremely flexible tool that has numerous applications to finance. It is
often used as a method of last resort when analytic solutions do not exist, or when other numerical
methods fail. Its drawback has been the amount of time it takes to resolve a problem accurately
using simulation, but as computers become more powerful this disadvantage becomes less relevant.
Risks is usually measured looking bacckwards in time. When we talk about volatility or risk
of a particular instrument or market, we usually base our predictions on the behavior of the asset
in the past. However, we are interested in knowing the risk that our portfolio is facing in the
future, not the one it would have faced in the past. The Monte Carlo simulation provides a forward
looking approach to compute the risk of a paortfolio. In order to measure risk in an consistent and
systematic way, we must be able to generate future possible scenarios based on hypothetical market
conditions. To know the hypothetical effects that those price changes would have on our portfolio,
we need a methodology to value all the instruments in our portfolio for each hypothetical scenario
or possible future.
Methodology
Let us examine more closely how a Monte Carlo Simulation works.We will use Black Scholes
model to simulate stock price S, which follows a geometric Brownian motion. The equation below
describes this :
dS/S = dt + dW

where
is expected rate of return;
is the volatility of the asset;
dW represents a Weiner process, shows by :

dW = dt
So we have the solution of our equation by using It lemma:
dln(S) = (

2
) dt + dW
2
14

Passing the exponential it has:


2
)t+W
2
So what we are saying in the above equation is that
the stock price returns are normally distributed with a mean of and a standard deviation of dt.
S(t) = S(0) exp(r

Estimation of and Historical volatility is a statistical standard deviation of daily returns.


Daily stock return is calculated as the variation between the natural logarithms over todays closing
price and the previous day. Then we calculate the standard deviation of its returns on the last n
days. Let :
St the price at time t
Rt , the return calculated from the total historical data.So we have:
Rt = ln(

St
)
St1

t is the mean of last n values of Rt


n

t =

1X
Rtki
n
ki

the standard deviation

v
u
u
t = t

1 X
(Rt t )2
n1
ki

So we have to follow these steps.


Step 1 Determine the length T of the analysis horizon and divide it equally into a large number
N of small time increments t , with Euler Approximation:
S(t + t) = S(t) exp(r

2
) T + W
2

Where W represents the brownian motion increment with time t. According the definition of
brownian motion, this
increment follow a standard normal distribution of variance t, so we can
substitute W by Y t where Y reduced centered Gaussian variable. We got this formula
S(t + t) = S(t) exp(r

sigma2
t + Y t)
2

Step 2 Draw a random number from a random number generator and update the price of the
asset at the end of the first increment.
Step 3 Repeat Step 2 until reaching the end of the analysis horizon T by walking along the
N time intervals.

15

Step 4 Repeat Steps 2 and 3 a large number M of times to generate M different paths for the
stock over T.
Step 5 Rank the M terminal stock prices from the smallest to the largest, read the simulated
value in this series that corresponds to the desired (1-)% confidence level (95% or 99% generally)
and deduce the relevant VaR, which is the difference between Si and the th lowest terminal stock
price
2.3.1

Advantages and Disadvantages

Monte Carlo Simulations present some advantages over the Analytical and Historical Simulations
methodologies to compute VaR. The main benefit of running time-consuming Monte Carlo Simulations is that they can model instruments with non-linear and path-dependent payoff functions,
especially complex derivatives. Moreover, Monte Carlo Simulations VaR is not affected as much
as Historical Simulations VaR by extreme events, and in reality provides in-depth details of these
rare events that may occur beyond VaR. Finally, we may use any statistical distribution to simulate
the returns as far as we feel comfortable with the underlying assumptions that justify the use of a
particular distribution.
The main disadvantage of Monte Carlo Simulations VaR is the computer power that is required
to perform all the simulations, and thus the time it takes to run the simulations. If we have a
portfolio of 1,000 assets and want to run 1,000 simulations on each asset, we will need to run 1
million simulations (without accounting for any eventual simulations that may be required to price
some of these assets like for options and mortgages, for instance). Moreover, all these simulations
increase the likelihood of model risk. Consequently, another drawback is the cost associated with
developing a VaR engine that can perform Monte Carlo Simulations. Buying a commercial solution
off-the-shelf or outsourcing to an experienced third party are two options worth considering. The
latter approach will reinforce the independence of the computations and therefore reliance of its
accuracy and non-manipulation.

16

Figure 6: Summary of methods advantages and disadvantages

Case study: MonteCarlo VaR for a portofolio of two assets

We use the R software to automate our simulations and different calculations.


For this study we consider LOreal and Michelin shares, both listed on Euronext Paris. We
consider a window of 500 daily quotations ranging from 02/03/2014 to 01/01/2014. We calculate
the coefficient of correlation between the two assets on the basis of historical data,exactly the
variations of each asset with R corr () function. We found that the coefficient of correlation = 0.11
Then we calculate the VaR method Monte Carlo for each asset using the method described above,
using the algorithm in the Appendix which generally consists of:
use historical data to estimate and
calculate the daily variations
sort gains and losses
select VaR according confidence level
V arN days according to the formula V aRN days = V aR1day

Thus we find from our simulations that the value of the VaR for Michelin share is:
michelin
V aR99%,1d
= 3.36

17

Figure 7: MonteCarlo VaR %

And the VaR for the window of 500 days is:


michelin
michelin
V aR99%,500d
= V aR99%,1d

500

michelin
V aR99%,500d
= 75.131

We proceed in the same way to find the VaR to 500 days for the share lOreal
0

l Oreal
V aR99%,500d
= 48.075

Once we VaR for each asset, we can calculate the VaR for the portfolio according to the following
formula or is the correlation coefficient between two assets:
q
portf olio
michelin )2 + (V aRl0 Oreal )2 + 2 V aRmichelin V aRl0 Oreal
V aR99%,500d
= (V aR99%,500d
99%,500d
99%,500d
99%,500d
portf olio
V aR99%,500d
=

p
75.1312 + 48.0752 + 2 0.11 75.131 48.075

Finaly,
portf olio
V aR99%,500d
= 93.54

The Monte Carlo Classic converges very slowly in the order of 1N . It could be improved by
using a Monte Carlo variance reduction that achieves results faster with more precision.

18

Conclusion
In conclusion, we note that the Value at Risk is a simple indicator of overall risks. It is particularly
easy to understand because it measures a loss potential that takes parameters for a time horizon
and interval confidence. VaR is now a key indicator in the risk management. Its effect was greatly
popularized in the 1990s and later became inevitable as the VaR (99%, 10 days) appears in the Basel
II as the Preferred method of risk measurement. Finally, if var has some limitations, various tools
have been implemented at the discretion of time to reduce them, and now with the back-testing
and scenario stress tests, the quality of the VaR is guaranteed. Ultimately, this project graduation
was for us a great opportunity to look more closely at methods of measuring risks. Value at Risk
is a term in the current financial language and there is no doubt that this project will bring us
gain substantially. Our graduation project has also appeared as a relevant conclusion of our year
specialization Risk Engineering, since it takes the concepts of finance and mathematics addressed
in different courses during this period.

Annex

Historical method algorithm

ValeurHistMichelin <- read.csv("C:/Users/ErhanDincer/Desktop/TER/table.csv", header = TRUE)

VaR <- function(T,alpha){


Diff <- Michelin[5] - Michelin[2]
D <- Diff[1:T,]
G <- sort(D)
R <- 100-alpha
y <- T*R/100
return (G[y])
}
VaR(500,95)
This algorithm permits to compute VaR, whith historical data, here with a confidence level of 95
% and a horizon of 500.
Monte Carlo method algorithm

Michelin <- read.csv("C:/Users/ErhanDincer/Desktop/TER/table.csv")


g <- Michelin[2]
ValeurHist <- g[1:500,]

Rendement <- function(T){

# T:le nombre de valeur historique quon prend


19

R <- c(1:(T-1))
for(i in 1:(T-1)){
R[i]=log(ValeurHist[i+1]/ValeurHist[i])
}
return(R)
}

Mu <- function(T){
Rendements <- Rendement(T)
s <- mean(Rendements)
return(s)
}

Ecarttype <- function(T){ #T:le nombre de valeur historique quon prend


Rendements <- Rendement(T)
E <- sd(Rendements)
return(E)
}
LoiNormale <- function(T){
E <- Ecarttype(T)
M <- Mu(T)
x <- rnorm(1,0,1)
return (x)
}
LoiNormale(500)
SimulationDePrix <- function(s0,T,alpha){
# T : lHorizon
Volatilit <- Ecarttype(T)*sqrt(T)
Mu <- Mu(T)
t <- 1/T
Jour <- c(1:(T+1))
Prix_Actif_ <- c(1:(T+1))

# s0 : la valeur de lactif a linstant t=1

for(i in 1:T){
Prix_Actif_[1] = s0
Prix_Actif_[i+1] = Prix_Actif_[i]*exp((Mu-(Volatilit^2/2))*t+Volatilit*LoiNormale(T)*sqrt(t))
}

#plot(Jour,Prix_Actif_,type="l",col="red",ylim=c(s0-30,s0+30),main="Simulation de prix dun acti

20

VariationJ <- c(1:T)


for(i in 1:T){
VariationJ[i] = Prix_Actif_[i+1] - Prix_Actif_[i]
}
Tt <- sort(VariationJ)
R <- 100-alpha
y <- T*R/100
return(Tt[y])
}

MonteCarlo <- function(n,alpha,T,s0){ #n : nombre de simulation quon veut


# alpha : le risque
# T : lHorizon
# s0 : le prix de lactif a linstant t=1
x <- c(1:n)
Moyenne=c(1:n)
NombreDeSimulation=c(1:n)
Variance=c(1:n)
z=0
g=0
bi=c(1:n)
bs=c(1:n)
for(i in 1:n){
x[i] <- SimulationDePrix(s0,T,alpha)
z=z+x[i]
Moyenne[i]=z/i
}
Be <- z/n
for(i in 1:n){
g=g+(x[i]-Moyenne[i])^2
Variance[i]=g/(i-1)
bi[i]=Moyenne[i]-(1.96*(sqrt(Variance[i]/i)))
bs[i]=Moyenne[i]+(1.96*(sqrt(Variance[i]/i)))
}
plot(NombreDeSimulation,Moyenne,type="l")
points(bi, col=red, type=l)
points(bs, col=red, type=l)
21

return (Be)
}
MonteCarlo(1000,99,500,77.25)
In this case, we compute Monte Carlo VaR with 1000 simulations, a confidence level of 99% and
and a window of 500 days.
A part of lOreal Data
Date;Ouverture;Cloture;Plus Haut;Plus Bas;Volume
18/01/2012;81,76;81,78;82,75;81,28;769 466
19/01/2012;82,14;82,35;82,50;81,44;708 219
20/01/2012;81,30;81,06;81,74;80,19;1 099 500
23/01/2012;81,04;80,70;81,23;80,05;618 339
24/01/2012;80,45;80,82;81,00;79,99;658 221
25/01/2012;81,04;80,61;81,28;80,17;542 286
26/01/2012;81,01;82,10;82,50;80,85;810 875
27/01/2012;81,84;81,12;82,89;81,12;853 143
30/01/2012;80,91;81,44;81,75;80,87;834 430
31/01/2012;81,82;81,31;81,93;81,11;698 274
01/02/2012;81,73;82,70;82,74;81,62;1 018 660
02/02/2012;82,98;82,55;83,32;82,43;610 475
03/02/2012;82,23;82,06;82,25;81,05;1 283 910
06/02/2012;81,71;81,68;81,95;81,15;590 822
07/02/2012;81,94;82,25;82,52;81,14;854 766
08/02/2012;82,60;81,60;82,97;81,49;753 185
09/02/2012;81,73;82,22;82,76;81,52;640 602
10/02/2012;81,72;81,38;81,88;81,00;796 133
13/02/2012;81,63;81,65;81,94;80,93;558 072
14/02/2012;83,00;84,73;85,19;82,80;2 684 180
15/02/2012;85,70;85,40;86,00;84,89;1 369 010
16/02/2012;85,00;85,38;85,50;84,52;797 988
17/02/2012;85,60;85,75;86,12;85,32;850 617
20/02/2012;85,95;85,59;85,99;85,14;573 836
21/02/2012;85,12;85,19;85,45;84,21;742 402
22/02/2012;85,00;85,06;85,23;84,46;496 696
23/02/2012;85,18;85,85;86,04;85,00;854 597
24/02/2012;85,80;85,00;85,99;84,39;805 149
27/02/2012;84,68;85,44;85,65;84,53;740 149
28/02/2012;85,65;85,64;86,00;85,15;658 276
29/02/2012;85,89;85,61;86,11;85,41;658 088
01/03/2012;85,62;87,49;87,49;85,27;1 142 040
02/03/2012;87,12;87,68;87,78;87,11;720 858
05/03/2012;87,50;88,48;88,57;87,34;968 767
06/03/2012;88,29;85,85;88,30;85,85;992 657
07/03/2012;86,04;86,77;87,14;85,91;674 069
22

08/03/2012;86,86;88,88;88,88;86,60;1 062 430


09/03/2012;88,80;88,49;89,00;88,29;671 803
12/03/2012;88,98;89,23;89,29;88,58;718 192
13/03/2012;89,36;90,00;90,00;88,98;823 154
14/03/2012;90,00;89,57;90,00;89,35;826 754
15/03/2012;89,50;89,40;89,82;88,78;979 774
16/03/2012;89,50;89,20;89,95;89,20;1 203 600
19/03/2012;89,04;89,02;89,47;88,62;682 733
20/03/2012;88,81;88,49;88,98;87,92;486 077
21/03/2012;88,88;88,97;89,33;88,60;810 055
22/03/2012;88,61;88,91;89,05;88,15;637 466
23/03/2012;88,99;88,49;89,00;87,66;593 894
26/03/2012;88,63;89,23;89,37;88,43;768 481
27/03/2012;89,25;89,37;89,69;88,95;637 685
28/03/2012;89,16;89,08;90,19;89,05;883 140
29/03/2012;89,28;89,93;90,21;89,01;1 352 490
30/03/2012;90,06;92,49;92,53;89,92;1 361 070
02/04/2012;92,50;92,99;93,00;91,25;1 107 170
03/04/2012;92,92;92,70;92,97;92,35;951 978
04/04/2012;92,00;91,19;92,63;90,96;1 190 740
05/04/2012;91,44;91,40;91,84;90,79;873 882
10/04/2012;90,54;89,72;90,89;89,60;877 860
11/04/2012;89,80;90,42;90,86;88,82;926 800
12/04/2012;90,30;91,09;91,14;89,71;787 640
13/04/2012;94,74;92,14;94,80;91,34;2 213 420
16/04/2012;92,50;92,72;93,24;92,29;1 183 240
17/04/2012;92,70;93,68;93,68;92,33;1 159 570
18/04/2012;93,23;93,76;94,13;93,18;986 497
19/04/2012;94,15;91,74;94,30;91,64;1 429 040
20/04/2012;91,76;91,92;92,27;90,27;1 321 320
23/04/2012;91,23;89,62;91,23;89,06;972 047
24/04/2012;90,38;91,75;92,00;89,29;911 003
A part of Michelin Data
Date,
Open, High, Low, Close, Volume,Adj Close
2014-01-01,77.25,77.25,77.25,77.25,000,77.25
2013-12-31,77.00,77.29,76.40,77.25,109500,77.25
2013-12-30,76.85,76.99,76.44,76.63,271000,76.63
2013-12-27,76.50,76.85,76.34,76.61,408200,76.61
2013-12-26,75.90,75.90,75.90,75.90,000,75.90
2013-12-25,75.90,75.90,75.90,75.90,000,75.90
2013-12-24,76.17,76.60,75.58,75.90,121800,75.90
2013-12-23,74.75,76.23,74.75,75.69,482600,75.69
2013-12-20,75.15,75.49,74.34,74.71,1093400,74.71
2013-12-19,75.28,76.59,74.50,74.50,1247400,74.50
2013-12-18,74.99,75.48,74.32,74.50,969700,74.50
2013-12-17,75.64,75.78,74.50,74.50,631400,74.50
23

2013-12-16,75.14,76.28,74.85,75.91,466800,75.91
2013-12-13,75.27,76.36,75.10,75.62,469500,75.62
2013-12-12,75.50,75.97,75.10,75.23,441100,75.23
2013-12-11,75.91,76.63,75.59,75.68,402500,75.68
2013-12-10,77.24,77.24,75.95,75.95,414400,75.95
2013-12-09,77.45,77.90,76.90,77.12,408200,77.12
2013-12-06,76.77,77.55,76.10,77.21,428800,77.21
2013-12-05,77.39,77.71,76.51,76.80,490500,76.80
2013-12-04,78.49,79.62,77.00,77.39,618300,77.39
2013-12-03,79.16,79.40,77.66,77.66,440800,77.66
2013-12-02,79.95,80.24,79.44,79.44,335800,79.44
2013-11-29,79.61,80.02,79.61,79.95,437100,79.95
2013-11-28,80.01,80.49,79.81,80.09,306600,80.09
2013-11-27,80.10,80.34,79.61,80.11,577900,80.11
2013-11-26,79.83,80.76,79.70,79.70,820900,79.70
2013-11-25,80.00,80.73,79.94,80.45,548500,80.45
2013-11-22,79.02,80.75,79.02,80.55,528100,80.55
2013-11-21,79.16,79.65,78.70,79.00,546200,79.00
2013-11-20,80.08,80.89,79.97,80.66,386300,80.66
2013-11-19,80.66,81.17,79.87,80.25,514600,80.25
2013-11-18,79.52,81.37,79.19,81.05,625000,81.05
2013-11-15,78.85,79.55,78.80,79.41,646800,79.41
2013-11-14,78.80,78.81,78.17,78.44,385600,78.44
2013-11-13,78.26,78.54,76.92,78.09,433700,78.09
2013-11-12,78.28,79.05,78.15,78.58,335900,78.58
2013-11-11,78.56,78.87,78.27,78.58,245400,78.58
2013-11-08,78.10,78.57,77.40,78.43,507800,78.43
2013-11-07,76.80,79.40,76.80,78.58,1053300,78.58
2013-11-06,76.49,77.42,76.44,76.78,460700,76.78
2013-11-05,77.66,77.75,76.22,76.37,570100,76.37
2013-11-04,78.25,78.25,76.73,77.31,458000,77.31
2013-11-01,77.35,77.54,76.32,76.60,408300,76.60
2013-10-31,77.02,77.46,76.47,77.02,726700,77.02
2013-10-30,76.87,78.20,76.81,77.26,671900,77.26
2013-10-29,77.00,77.15,76.10,76.78,1870500,76.78
2013-10-28,80.66,80.80,79.36,79.75,665200,79.75
2013-10-25,81.19,81.41,80.33,80.42,518500,80.42
2013-10-24,81.63,81.98,81.29,81.53,462900,81.53
2013-10-23,81.67,81.92,80.45,81.20,597400,81.20
2013-10-22,80.87,82.86,80.79,81.93,746100,81.93
2013-10-21,80.99,81.18,79.55,80.91,565200,80.91
2013-10-18,79.46,80.79,79.31,80.74,585600,80.74
2013-10-17,79.65,80.15,78.95,79.08,516100,79.08
2013-10-16,79.74,79.93,78.90,79.61,513100,79.61
2013-10-15,79.73,80.23,78.69,79.71,800800,79.71
2013-10-14,79.00,79.15,77.78,78.19,587600,78.19
2013-10-11,79.23,79.65,77.82,79.27,575000,79.27
2013-10-10,76.72,78.85,76.00,78.72,929000,78.72
24

2013-10-09,77.38,78.12,76.01,76.33,907200,76.33
2013-10-08,78.37,78.49,77.35,77.55,729300,77.55
2013-10-07,79.20,79.50,78.12,78.17,841900,78.17
2013-10-04,78.23,80.10,77.35,79.47,986700,79.47
2013-10-03,79.00,79.55,78.27,78.59,1491300,78.59
2013-10-02,82.93,83.42,79.94,80.75,1714700,80.75
2013-10-01,82.42,83.67,82.24,83.65,564100,83.65
2013-09-30,82.44,82.58,81.09,81.97,800200,81.97
2013-09-27,82.05,83.71,81.55,83.41,670400,83.41
2013-09-26,81.87,82.29,81.11,81.91,405100,81.91
2013-09-25,81.69,82.30,81.14,81.84,464800,81.84
2013-09-24,81.75,82.67,80.88,81.84,589800,81.84
2013-09-23,82.00,82.60,81.17,81.40,580000,81.40

25

Bibliography
1. Value at risk models,The Wiley Finance Series, Carole Alexander
2. Value at Risk:An Overview of Analytical VaR J.P. Morgan Investment Analytics Consulting,Romain Berry
3.Calcul de la Value-at-Risk avec intgration des scnarios de stress-tests: Hichem BostangiMohamed Fenina-Benjamin Guillet
4. La Value at risk un outil de gestion de risque discutable, Travail de mmoire,Diego Trigo
da Silva
5.http : //help.riskmetrics.com/RiskM anager3/Content/StatisticsR ef erence/V aR.htm
6.http : //risklearn.com/value at risk var

26

Você também pode gostar