Historical simulation
Suppose that a UK investor has invested 30% of her wealth in the FTSE index, 40% in the S&P 500 index, and 30% in the SMI index.
For different vectors of log-returns for the 5 risk factors, the function lossop()
computes the loss or gain incurred by the investor when her total wealth is 1. The function can also be applied to a 5-dimensional time series of log-returns to obtain a time series of historically-simulated losses and gains corresponding to each vector of log-returns in the time series.
The function lossop()
is the so-called loss operator for the portfolio and has been specially written for this exercise. In general, for each new portfolio, a specific function has to be written to compute portfolio losses and gains.
In this exercise, you will form historically simulated losses and examine them. This is a necessary prelude to using these data to estimate VaR and ES.
This exercise is part of the course
Quantitative Risk Management in R
Exercise instructions
- Calculate the loss that would result from a log-return of -0.1 for all five risk factors (this has been done for you).
- Create the object
hslosses
by applyinglossop()
toreturns
, and then plothslosses
. - Form a Q-Q plot of
hslosses
against the normal distribution. - Plot the sample acf of
hslosses
and of then of the absolute values inhslosses
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate the loss from a log-return of -0.1 for all risk factors
lossop(rep(-0.1, 5))
# Apply lossop() to returns and plot hslosses
___ <- lossop(___)
# Form a Q-Q plot of hslosses against normal
# Plot the sample acf of hslosses and their absolute values