# Technical Details

##### The following is taken from my book Financial Risk Forecasting.

There is no one concept called risk, and even in my special case on these pages, market risk. That said, there are conventions in the market risk world and I will follow those.

My notions of risk is one day Value-at-Risk (VaR) and Expected Shortfall (ES). VaR is the most common, but ES is in the ascendance because of its inclusion in Basel III. While there are some who claim ES is superior to VaR, that this only in theory, not in practice as VaR is subadditive in most cases, and less accurately measured, see Why risk is hard to measure.

Why not then multi day risk as the Basel Accords specify? While that is complicated, a quick answer is that there is no correct way to measure multi day risk, and in practice it is just scaled one day risk. While it might make sense for the regulators to use multi day risk to sneak in tougher capital requirements, technically it is just scaled one day risk.

The probabilities are 1%, but one can also say 99%, i.e. one day out of 100, or ince i

Risk measures like VaR and ES are expressed in monetary units. You have a portfolio of some value, and risk is the potential monetary loss on that portfolio. In these pages I chose 100 as my portfolio value. So, if VaR is $4.5 then that number is an indication of potential losses over the next trading day of a portfolio worth$100.

There is no technical reason why VaR and ES could not exceed the portfolio value 100, even though conceptually that makes no sense, But it can happen simply because of the way the math works. Therefore, one should cap the measurements at 100.

I also do two more notions of risk, the worst expected price drop over some long time period like 25 years, and the probability of a large price drop, like 10%. The only sensible way to do such estimation is extreme value theory (EVT).

After picking a notion of risk, we then have to estimate a risk model and use that to forecast risk over the next trading day. While there is a seemingly infinite number ways to do that, only a small number are commonly used, especially the six discussed below. While it might be possible to argue that others are better in some special cases, the advantages are usually trivial in real life. As usually is the case, the increased complexity is not worth it.

The final modelling determination is the estimation window, how many days to use in the estimation. I picked thousand. Anything below just creates too much error, and more than thousand requires more data than might be available while bringing increasingly marginal benefits. So thousand it is.

The information below comes from Financial Risk Forecasting.

##### Notation
SyntaxDescription
$$p$$Probability
$$y_t$$Return
$$q_t$$Profit and loss
$$\vartheta$$Portfolio value
$$\vartheta$$Portfolio value
$$\sigma_t$$Volatility
$$\lambda, \alpha, \beta, \iota, \xi$$model parameters
$$z_t$$Residuals
$$W_E$$Estimation window

#### Details

Returns are log returns,

$$y_t=\log(p_t/p_{t-1}).$$

I assume that the mean is zero.

#### Notions of risk

##### VaR

The loss on a trading portfolio such that there is a probability $$p$$ of losses equalling or exceeding $$VaR$$ in a given trading period and a $$(1-p)$$ probability of losses being lower than VaR.

VaR is a quantile on the distribution of profit and loss profit and loss (P/L). If we hold one unit of an asset, the P/L would be indicated by:

$$q_t=P_t-P_{t-1}.$$

More generally, if the portfolio value is $$\vartheta$$ then $$q_t=\vartheta y_t$$ i.e. the P/L is the portfolio value times returns on day $$t$$. The density of the P/L is denoted by $$f_q\left(\cdot\right)$$. VaR is then given by: \begin{align} \Pr \left[ q\leq -VaR(p)\right] =\int_{-\infty }^{-VaR(p)}f_q\left( x\right) dx= p \end{align}

We use a minus sign because VaR is a positive number, and we are dealing with losses — that is probability of losses being larger (more negative) than negative VaR.

##### Expected Shortfall, ES

Expected loss conditional on VaR being violated, i.e. the expected profit/loss of $$q$$, when it is lower than the negative VaR: \begin{align} ES=&-E [q | q \le -VaR(p)]\\ =&\frac{1}{p} \int^{-VaR}_\infty x f_q(x)dx \end{align}

#### Forecasting risk

Daily out-of-sample risk forecasts for a range of assets. Estimation window is 1000 days.

The risk forecast methods are historical simulation (HS), moving average normal (MA), exponentially weighted moving average normal (EWMA), normal GARCH, student-t GARCH and extreme value theory (EVT).

##### HS

Non-parametric method. The VaR is simply the negative $$(T \times p)^\text{th}$$ value in the sorted return vector, multiplied by the monetary value of the portfolio.

##### MA

Possibly the simplest volatility forecast model is a moving average (MA) model.

$$\hat{\sigma}^2_{t}=\frac{1}{W_E} \sum_{i=1}^{W_E}y_{t-i}^{2}$$

##### EWMA

\hat{\sigma}^2_{t} =(1-\lambda) y^2_{t-1} + \lambda \hat{\sigma}^2_{t-1}

where $$0<\lambda < 1$$ is the decay factor .

##### GARCH

$$\sigma^2_{t} =\omega +\alpha y_{t-1}^{2}+\beta \sigma^2_{t-1}.$$ The innovations are standard Gaussian.

We have to restrict the parameters to be positive for obvious reasons, but should $$\alpha+\beta <1$$? No.

##### tGARCH

A GARCH model where we let the innovations be Student-t with degrees of freedom $$\nu$$.

##### EVT

Start by getting the tail index from Hill

$$\hat{\xi}=\frac{1}{\hat{\iota}}=\frac{1}{w_n}\sum_{i=1}^{w_n}\log \frac{x_{\left( i\right) }}{u},$$ Then $$\widehat{VaR}(p)=u\left( \frac{w_n/T}{p}\right)^{\widehat{^{1/\iota }}}.$$

Code and data
Endogenous risk

##### Extreme risk
Daily market risk forecasts and analysis