The VaR at level alpha of a random variable with
distribution function F is defined as its left-quantile at alpha:
$$VaR_{alpha} = F^{-1}(alpha).$$
The ES at level alpha of a random variable with distribution
function F is defined by:
$$ES_{alpha} = 1 / (1 - alpha) * \int_{alpha}^1 VaR_u d u.$$
The stressed VaR and ES are the risk measures of the chosen model
component, subject to the calculated scenario weights. If one
of alpha, q, s (q_ratio, s_ratio) is
a vector, the stressed VaR's and ES's of the kth column of
x, at levels alpha, are equal to q
and s, respectively.
The stressed VaR specified, either via q or q_ratio, might not equal
the attained empirical VaR of the model component. In this
case, stress_VaR will display a message and the specs contain
the achieved VaR. Further, ES is then calculated on the bases of the achieved VaR.
Normalising the data may help avoiding numerical issues when the range of values is wide.