# Data

### 1. Profit/Loss Data

Data comes in various forms and $${ P/L }$$ is the simplest. The $${ P/L }$$ generated by an asset or portfolio over period, $$t$$, is the asset’s or portfolio’s value at the end of t plus any interim payments $${ D }_{ t }$$ less the asset value at the end of $${ t-1 }$$. This can be represented as:

$${ P/L }_{ t }={ P }_{ t }+{ D }_{ t }-{ P }_{ t-1 }$$

(Positive P/L indicates profits and the converse is a loss)

All payments should be evaluated at the same point by the following two ways:

i. Present value $$({ P/L }_{ t })=\frac { { P }_{ t }+{ D }_{ t } }{ 1+d } -{ P }_{ t-1 }$$ ( $$d$$ is the discount rate, $${ D }_{ t }$$ is paid at the end of $$t$$)

ii. Forward value $${ (P/L }_{ t })={ P }_{ t }+{ D }_{ t }-(1+d){ P }_{ t-1 }$$

### 2. Loss/Profit Data

Sometimes, when estimating $$VaR$$ and $$ES$$, it becomes more convenient to deal with data in $$L/P$$ form, which is a simple transformation of $$P/L$$ data:

$${ L/P }_{ t }=-{ P/L }_{ t }$$ (Positive $${ L/P }$$ indicates losses and negative values indicates profits)

### 3. Arithmetic Return Data

Arithmetic return, $${ r }_{ t }$$, is defined as:

$${ r }_{ t }=\frac { { P }_{ t }+{ D }_{ t }-{ P }_{ t-1 } }{ { P }_{ t-1 } } =\frac { { P }_{ t }+{ D }_{ t } }{ { P }_{ t-1 } } -1$$

(This value is equivalent to $${ P/L }_{ t }$$ divided by the asset’s value at the end of $$t-1$$)

It is important to note that arithmetic returns should not be used when we are concerned with long horizons.

### 4. Geometric Return Data

The geometric return, $${ R }_{ t }$$, is defined as:

$${ R }_{ t }=\ln { \left( \frac { { P }_{ t }+{ D }_{ t } }{ { P }_{ t-1 } } \right) }$$

(The assumption is that interim payments are continuously reinvested)

Geometric return is often preferred to arithmetic return as it ensures that asset prices or portfolio value is never negative. However, the relationship between the two types of returns is seen by rewriting the above equation using Taylor’s series expansion for the natural log:

$${ R }_{ t }=\ln { \left( \frac { { P }_{ t }+{ D }_{ t } }{ { P }_{ t-1 } } \right) } =\ln { (1+{ r }_{ t })={ r }_{ t }-\frac { 1 }{ 2 } } { r }_{ t }^{ 2 }+\frac { 1 }{ 3 } { r }_{ t }^{ 3 }-\frac { 1 }{ 4 } { r }_{ t }^{ 4 }+ …$$

from which we can clearly see that $${ R }_{ t }\sim { r }_{ t }$$ if the returns are small however, it grows as the returns get bigger.

Example 1: If the arithmetic returns $${ r }_{ t }$$ over some period of time are 0.04, calculate the geometric returns.

Solution: $${ R }_{ t }=\ln { (1+{ r }_{ t }) } =\ln { (1+0.04) } =\ln { (1.04)=0.0392 }$$

Example 2: If the geometric returns $${ R }_{ t }$$ are 0.07, over a specified period, calculate the arithmetic returns.

Solution: Recall, $$1+{ r }_{ t }=exp({ R }_{ t }),\quad then:\quad { r }_{ t }=exp({ R }_{ t })-1=exp(0.07)-1=0.0725$$

# Estimating Historical Simulations $${ V }_{ a }R$$

Historical simulation $$\left( HS \right)$$ is the simplest approach to estimate VaR by means of ordered loss observations. In theory, $$VaR$$ is the quantile demarcating the tail region from the non-tail region, where the size of the tail is determined by the confidence level. Assume we have n observations, and our confidence level is $$\alpha$$, we would want the $$(1-\alpha )n+1$$th highest observation, and we would use the commands ‘$$Large(Loss\_ data,{ (1-alpha) }^{ \ast }n+1)$$’ using Excel, or ‘$$Loss\_ data{ ((1-alpha) }^{ \ast }n+1)$$’ using MATLAB, provided in the latter case that our ‘$$Loss\quad data$$’ array is already sorted into ordered observations. $$HS\quad VaR$$ estimates can be obtained from a cumulative histogram or empirical cumulative frequency function. The empirical frequency function makes it very easy to obtain the $$VaR$$: we simply move up the cumulative frequency axis to where the cumulative frequency equals our confidence level, draw a horizontal line along to the curve, and then draw a vertical line down to the x-axis, which gives us our $$VaR$$. If there are n observations in total, the empirical cumulative frequency of the $$ith$$ such ordered observation is $$i/n$$.

# Estimating Parametric $${ V }_{ a }R$$

Estimating $$VaR$$ using parametric approaches requires us to explicitly specify the statistical distribution from which our data observations are drawn. We take account of both statistical distribution and the type of data to which it applies.

Estimating $$VaR$$ with Normally Distributed Profits/Losses

Assuming that $$P/L$$ is normally distributed, then our $$VaR$$ at the confidence level $$\alpha$$ is:

$$\alpha VaR={ -\mu }_{ P/L }+{ \sigma }_{ P/L }{ z }_{ \alpha }$$

(Where $${ z }_{ \alpha }$$ is the standard normal variate corresponding to $$\alpha$$ and $${ \mu }_{ P/L }$$,and $${ \sigma }_{ P/L }$$ are the mean and standard deviation of $$P/L$$). $${ z }_{ \alpha }$$ is the value of the standard normal variate such that $$\alpha$$ of the probability density mass lies to its left, and $$1-\alpha$$ of the probability density mass lies to its right.

Practically, $${ \mu }_{ P/L }$$ and $${ \sigma }_{ P/L }$$ are normally unknown,and therefore $$VaR$$ estimate would be given by:

$${ \alpha VaR }^{ e }={ -m }_{ P/L }+{ s }_{ P/L }{ z }_{ \alpha }$$

(where $${ m }_{ P/L }$$ and $${ s }_{ P/L }$$ are estimates of the mean and standard deviation of $$P/L$$.)

For normally distributed $$L/P$$ data, then: $${ \mu }_{ L/P }$$ = $${ -\mu }_{ P/L }$$ and $${ \sigma }_{ L/P }$$=$${ \sigma }_{ P/L }$$ implying that:

$$\alpha VaR = { \mu }_{ L/P } + { \sigma }_{ L/P }{ z }_{ \alpha }$$ ,and $${ \alpha VaR }^{ e } = { m }_{ L/P } + { s }_{ L/P }{ z }_{ \alpha }$$

Example:Let $$P/L$$ over a specified period be normally distributed with a mean of 12 and a standard deviation of 24. Calculate the 95% $$VaR$$ and the corresponding 99% $$VaR$$.

Solution: Recall that:

$$\alpha VaR = { -\mu }_{ P/L }+{ \sigma }_{ P/L }{ z }_{ \alpha }$$

Therefore, the 95% VaR is:

$$\quad -12+{ 24Z }_{ 0.95 }=-12+24\times 1.645=27.48$$

and the 99% VaR is:

$$\quad -12+{ 24Z }_{ 0.99 }=-12+24\times 2.326=43.824$$

Estimating $$VaR$$ with Normally Distributed Arithmetic Returns

Let the arithmetic returns be normally distributed with mean, $${ \mu }_{ r }$$ and standard deviation of $${ \sigma }_{ r }$$. We obtain the critical value of $${ r }_{ t }$$, $${ r }^{ \ast }$$, such that the probability of $${ r }_{ t }$$ exceeding $${ r }^{ \ast }$$ equals the confident level $$\alpha$$, therefore:

$${ r }^{ \ast }={ \mu }_{ r }-{ \sigma }_{ r }{ z }_{ \alpha }$$

Remember that actual return $${ r }_{ t }$$ is $$L/P$$ divided by the earlier asset value, $${ P }_{ t-1 }$$ , then:

$${ r }_{ t }=\frac { { P }_{ t }-{ P }_{ t-1 } }{ { P }_{ t-1 } } =\frac { { LOSS }_{ t } }{ { P }_{ t-1 } }$$

Substituting $${ r }^{ \ast }$$ for $${ r }_{ t }$$ gives the relationship between $${ r }^{ \ast }$$ and the $$VaR$$:

$${ r }_{ t }^{ \ast }=\frac { { P }_{ t }^{ \ast }-{ P }_{ t-1 } }{ { P }_{ t-1 } } =\frac { VaR }{ { P }_{ t-1 } }$$

Substituting the equation of $${ r }^{ \ast }$$ into the equation of $${ r }_{ t }^{ \ast }$$ will give the $$VaR$$ :

$$\alpha VaR=-\left( { \mu }_{ r }-{ \sigma }_{ r }{ z }_{ \alpha } \right) { P }_{ t-1 }$$

Example: The arithmetic returns $${ r }_{ t }$$, over some period of time, are normally distributed with a mean of 1.34 and a standard deviation 1.96. The portfolio is currently worth 1. Calculate the 95% $$VaR$$ and 99% $$VaR$$.

Solution: Recall, $$\alpha VaR=-\left( { \mu }_{ r }-{ \sigma }_{ r }{ z }_{ \alpha } \right) { P }_{ t-1 }$$

Therefore,the 95% VaR is: $$\quad -1.34+1.96\times 1.645=1.8842$$

and the 99% VaR is: $$\quad -1.34+1.96\times 2.326=3.2190$$

Estimating Lognormal $$VaR$$

Let the geometric returns be normally distributed with mean $${ \mu }_{ R }$$ and standard deviation $${ \sigma }_{ R }$$. If $${ D }_{ t }$$ is zero, then ln $${ P }_{ t }$$ is normally or lognormally distributed. A random variate $$X$$ is lognormally distributed if $$lnX$$ is normally distributed. Lognormal is often represented in terms of $$m$$ and $${ \sigma }$$, where $$m$$ is the median of $$X$$ and $$m=exp(\mu )$$. The pdf of $$X$$ is written as:

$$\emptyset (x)=\frac { 1 }{ x\sigma \sqrt { 2\pi } } exp\left\{ -\frac { 1 }{ 2 } { \left( \frac { \log { (x)-\mu } }{ \sigma } \right) }^{ 2 } \right\} \quad, for\quad X>0$$

Let $$w=exp\left( { \sigma }^{ 2 } \right)$$, For convenience. The mean and variance of the lognormal can be written as:

$$Mean=m\quad exp({ \sigma }^{ 2 }/2)\quad$$

and

$$Variance={ m }^{ 2 }w(w-1)$$

The skewness of the lognormal is:

$$Skewness=(w+2){ (w-1) }^{ 1/2 }$$

and is always positive, which confirms the lognormal has a long right-hand tail. The kurtosis of the lognormal is:

$$Kurtosis={ w }^{ 4 }+2{ w }^{ 3 }+3{ w }^{ 2 }-3$$

and therefore varies from a minimum of (just over) 3 to a potentially large value depending on the value of s.

Deriving the critical value of $$R$$, $${ R }^{ \ast }$$, such that the probability of $$R>{ R }^{ \ast }$$ is $$\alpha$$:

$${ R }^{ \ast }={ \mu }_{ R }-{ \sigma }_{ R }{ z }_{ \alpha }$$

Using the definition of geometric return, we unravel the critical value of $${ P }^{ \ast }$$, and thence infer our $$VaR$$:

$${ R }^{ \ast }=ln({ P }^{ \ast }/{ P }_{ t-1 })=ln{ P }^{ \ast }-ln\quad { P }_{ t-1 }$$ Implying that:

$$ln{ P }^{ \ast }={ R }^{ \ast }+ln{ P }_{ t-1 }$$

Therefore,

$${ P }^{ \ast }={ P }_{ t-1 }exp\left[ { R }^{ \ast } \right] ={ P }_{ t-1 }exp\left[ { \mu }_{ R }-{ \sigma }_{ R }{ Z }_{ R } \right]$$

This therefore implies that:

$$\alpha VaR={ P }_{ t-1 }-{ P }^{ \ast }={ P }_{ t-1 }(1-exp\left[ { \mu }_{ R }-{ \sigma }_{ R }{ z }_{ \alpha } \right] )$$

This gives the lognormal $$VaR$$ consistent with normally distributed geometric returns.

Example:Let’s assume that the geometric returns $${ R }_{ t }$$, are distributed as normal with a mean 0.06 and standard a deviation 0.30. The portfolio is currently worth 1. Calculate the 95% and 99% lognormal $$VaR$$.

Solution: From the lognormal derivation, $$\alpha VaR={ P }_{ t-1 }-{ P }^{ \ast }={ P }_{ t-1 }(1-exp\left[ { \mu }_{ R }-{ \sigma }_{ R }{ z }_{ \alpha } \right] )$$. Applying the formula in the question we have:

$$95\%\quad VaR=1-exp(0.06-0.30\times 1.645)=0.3518$$

$$99\%\quad VaR=1-exp(0.06-0.3\times 2.326)=0.4689$$

# Estimating Coherent Risk Measures

Estimating expected shortfall

The $$ES$$ is the probability weighted-average of tail losses. We can estimate ES as an average of ‘$$tail VaRs$$’ by slicing the tails into a large number of n slices each of which has the same probability mass. Then estimate the $$VaR$$ associated with each slice and take the $$ES$$ as the average of the $$VaRs$$. Suppose we wish to estimate 95% $$ES$$ on the assumption that losses are normally distributed with mean zero and standard deviation 1. We would use a high value n and carry out calculations on a spreadsheet or usingan appropriate software. The value of n should be large enough to give accurate results. However, to show the procedure manually let us work with a very small n value of 10, this gives us $$9(n-1)$$ tail $$VaR$$ or $$VaR$$ at confidence levels.

Estimating coherent risk measures

Recall that coherent risk measure is a weighted average of quantities (denoted by $${ q }_{ p }$$) of our loss distribution:

$${ M }_{ \emptyset }=\int _{ 0 }^{ 1 }{ \emptyset (p){ q }_{ p }dp }$$

where the weighting function or the risk aversion function $$\emptyset (p)$$ is specified by the user.

The $$ES$$ is a special case of $${ M }_{ \emptyset }$$ obtained by setting $$\emptyset (p)$$ :

$$\emptyset (p)=\begin{cases} 0, \\ 1/(1-\alpha ), \end{cases}\begin{matrix} p<\alpha \\ p\ge \alpha \end{matrix}$$

Replacing the equal weights in the average $$VaR$$ algorithm with $$\emptyset (p)$$ weights appropriate to the risk measure being estimated can be done by supposing we have the exponential weighting function:

$${ \emptyset }_{ \gamma }(p)=\frac { { e }^{ -(1-p)/\gamma } }{ \Upsilon (1-{ e }^{ -1/\gamma}) }$$

we can represent the degree of risk aversion by setting γ=0.05

As the $$ES$$ estimation, when using this routine in practice, we would want the value of n to be large enough to give accurate results by starting with a small value of n and then double repeatedly until the estimate settle down sufficiently. This halves the width of the discrete slices. The halving error is given by, $${ \varepsilon }_{ n }={ M }^{ (n) }-{ M }^{ (n/2) }$$ , where $${ M }^{ (n) }$$ is the estimated risk measure based on n slices. We stop doubling n when $${ \varepsilon }_{ n }$$ falls below some tolerance level indicating an acceptable level of accuracy.

Example: Suppose that we make the empirical assumption that the mean and volatility of annualized returns are 0.10 and 0.40. We are interested in the 95% $$VaR$$ at the 1-day holding period for a portfolio worth $1. Assuming there are 250 trading days in the year, calculate the normal 95% $$VaR$$ and lognormal 95% $$VaR$$. Solution: The daily return has a mean $$0.1/250 = 0.00040$$ and standard deviation $$0.40/\sqrt { 250 } =0.0253$$. Then, the normal 95% $$VaR$$ is $$-0.0004 + 0.0253 x 1.645 = 0.0412$$. Therefore, the normal $$VaR$$ is 4.12% If we assume a lognormal, then the 95% $$VaR$$ is $$1 – exp(0.0004 – 0.0253 \times 1.645) = 0.0404$$. This implies that the lognormal $$VaR$$ is 4.04% of the value of the portfolio. # Estimating the Standard Errors of Risk Measure Estimators We should always seek to supplement any risk estimates we produce with some indicator of their precision. The precision of estimators of risk measures is evaluated by means of their standard errors or by producing confidence intervals for them. Standard Errors of Quantile Estimators Suppose $$F(x)$$ is a distribution function, either parametric distribution function or an empirical distribution function, estimated from real data with a corresponding density or relative-frequency function $$f(x)$$. Let sample size be n,and bin width be h. Let also $$dF$$ is probability of observations falling below some value , that one observation falls in the range $$q\pm h/2$$, and $$(n-k)$$ observations are greater than $$q + h/2$$, If $$dF$$ is the probability that $$(k-1)$$ observations will fall below some value $$q – h/2$$, and that one observation will fall in the range $$q\pm h/2$$, and n – k observations will fall in the range $$q + h/2$$, then $$dF$$ is proportional to: $${ \left\{ F(q) \right\} }^{ k-1 }f\left( q \right) dq{ \left\{ 1-F(q) \right\} }^{ n-k }$$ If this proportion is $$p$$, the above equation is approximately equal to: $${ p }^{ np }{ \left( 1-p \right) }^{ n(1-p) }$$ for large values of $$n$$. If $$\varepsilon$$ is a very small increment to $$p$$, then: $${ p }^{ np }{ (1-p) }^{ n(1-p) }\approx { (p+\varepsilon ) }^{ np }{ (1-p-\varepsilon ) }^{ n(1-p) }$$ Thus: $${ (p+\varepsilon ) }^{ np }{ (1-p-\varepsilon ) }^{ n(1-p) }\approx -\frac { { n\varepsilon }^{ 2 } }{ 2p(1-p) }$$ Therefore, the distribution function $$dF$$ is approximately proportional to: $$exp\left( \frac { -{ \varepsilon \varepsilon }^{ 2 } }{ 2p(1-p) } \right)$$ Integrating this out we get: $$dF=\frac { 1 }{ \sqrt { 2\pi \sqrt { p(1-p)/n } } } exp\left( \frac { -n{ \varepsilon }^{ 2 } }{ 2p(1-p) } \right) d\varepsilon$$ From which $$\varepsilon$$ is normally distributed in the limit with variance $$p(1 – p)/n$$. But: $$d\varepsilon =dF(q)=f(q)dq$$ So the variance of $$q$$ is: $$var(q)\approx \frac { p(1-p) }{ n{ \left[ f\left( q \right) \right] }^{ 2 } }$$ This is the approximate for variance whose square root is the standard error of a quantile estimator $$q$$. Although we can use quantile standard error to estimate $$VaR$$ confidence intervals, the intervals can be wide and also sensible to an arbitrary choice of bin width. Standard Error in Estimators of Coherent Risk Measures The standard error of an estimator of a coherent risk measure will vary from one situation to another. Always estimate the standard error whenever you estimate the risk measure itself. Estimating the standard error of an estimator of a coherent risk measure recognizes that a coherent risk measure is an L-estimator (weighted average of order statistics) which is asymptomatically normal. For $$N$$ discrete points in the density function, as $$N$$ gets large, the variance of the estimator of the coherent risk measure is approximately: $$\sigma { (M }_{ \emptyset }^{ (N) })\rightarrow \frac { 2 }{ N } \int _{ p<q }^{ }{ \emptyset (p)\emptyset (q)\frac { p(1-q) }{ f({ F }^{ -1 }(p))f({ F }^{ -1 }(q)) } dpdq=\frac { 2 }{ N } \int _{ x<y }^{ }{ \emptyset (F(x))\emptyset (F(y))F(x)(1-F(y))dxdy } \\ }$$ When the risk measure is the $$ES$$, the standard error becomes: $$\sigma ({ ES }^{ (N) })\rightarrow \frac { 1 }{ N{ \alpha }^{ 2 } } \int _{ 0 }^{ { F }^{ -1(\alpha )F } }{ \int _{ 0 }^{ (\alpha ) }{ \left[ min(F(x),F(y))-F(x)F(y) \right] } dxdy }$$ This gives good estimates even for relatively low values of $$N$$. When confronted with a new data set, never proceed to estimate without some preliminary data analysis. Plot data on a histogram and estimate the relevant summary statistics like mean, standard deviation, skewness, kurtosis and many more. Then consider the distribution fitting the data. QQ Plots One of the most useful and popular diagnostic tools for this purpose is the quantile-quantile or QQ plots. These are plots of empirical quantiles against their theoretical equivalents.A QQ plot is useful in a number of ways. First, we can use a QQ plot to form a tentative view of the distribution from which our data might be drawn: we specify a variety of alternative distributions, and construct QQ plots for each. If the data are drawn from the reference population, then the QQ plot should be linear. Any reference distributions that produce non-linear QQ plots can then be dismissed, and any distribution that produces a linear QQ plot is a good candidate distribution for our data.Also,we can use the intercept and slope of a linear QQ plot to give us a rough idea of the location and scale parameters of our sample data. Moreover, if the empirical distribution has heavier tails than the reference distribution, the QQ plot will have steeper slopes at its tails, even if the central mass of the empirical observations are approximately linear. Finally, a QQ plot is good for identifying outliers (e.g., observations contaminated by large errors). # Practice questions 1) If the arithmetic returns $${ r }_{ t }$$ over some period of time are 0.075, what are the geometric returns? 1. -2.59 2. 0.0723 3. 0.0779 4. 0.0895 The correct answer is b. Recall that,$${ R }_{ t }=ln\left( 1+{ r }_{ t } \right)$$ Therefore, $$ln(1+.075) = ln(1.075) = 0.0723$$ 2) Let the geometric returns $${ r }_{ t }$$ be 0.020, over a specified period, calculate the arithmetic returns. 1. 0.1823 2. 0.0182 3. 0.0202 4. 0.2020 The correct answer is c. Recall, $$1+{ r }_{ t }=exp({ R }_{ t })$$, then: $${ r }_{ t }=exp({ R }_{ t })-1$$ Implying that: $$exp(0.020) – 1 = 0.0202$$ 3) Assuming that $$P/L$$ over a specified period is normally distributed and has a mean of 13.9 and standard deviation of 23.1. What is the 95% $$VaR$$? 1. 23.90 2. 24.10 3. 51.90 4. 59.18 The correct answer is a. Recall that: $$\alpha VaR=-{ \mu }_{ P/L }+{ \sigma }_{ P/L }{ z }_{ \alpha , }$$ 95% of the area under a normal curve lies within roughly 1.96 standard deviations of the mean, and due to the central limi theorem, this number is therefore used in the construction of approximate 95% confidence intervals. Therefore 95% $$VaR$$ is: $$-13.9+23.1{ Z }_{ 0.95 }=-13.9+23.1\times 1.96=23.90$$ 4) The arithmetic returns $${ r }_{ t }$$, over some period of time, are normally distributed with a mean of 1.89 and a standard deviation 0.98. The portfolio is currently worth$1. Calculate the 99% $$VaR$$.

1. 0.3895
2. 4.1695
3. 3.8108
4. 0.0308

Recall, $$\alpha VaR=-({ \mu }_{ r }-{ \sigma }_{ r }{ z }_{ \alpha }){ P }_{ t-1 }$$,

99% $$VaR$$ : $$-1.89+0.98\times 2.326=0.3895$$

5) Assuming we make the empirical assumption that the mean and volatility of annualized returns are 0.24 and 0.67. Assuming there are 256 trading days in the years, calculate the normal 95% $$VaR$$ and lognormal 95% $$VaR$$ at the 1-day holding period for a portfolio worth \$1.

1. 95% $$VaR$$: 6.80%; lognormal 95% $$VaR$$: 6.57%.
2. 95% $$VaR$$: 6.57%; lognormal 95% $$VaR$$: 6.80%.
3. 95% $$VaR$$: 5.95%; lognormal 95% $$VaR$$: 7.80%.
4. 95% $$VaR$$: 7.80%; lognormal 95% $$VaR$$: 6.57%.

The daily return has a mean $$0.24/265 = 0.0009375$$ and standard deviation $$0.67/\sqrt { 250 } =0.04188$$
Then, the normal 95% $$VaR$$ is $$-0.009375+0.041875\times 1.645=0.06796$$.
Therefore, the normal $$VaR$$ is 6.796%
If we assume a lognormal, then the 95% $$VaR$$ is $$1-exp(0.0009375-0.04188\times 1.645)=0.0657$$
This implies that the lognormal $$VaR$$ is 6.57% of the value of the portfolio.
This illustrates that normal and lognormal $$VaRs$$ are much the same if we are dealing with short holding periods and realistic return parameters