Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 Quantlet: VaRest Description: estimates the value at risk (VaR).

 Usage: VaR = VaRest(y{,method}{,opt}) Input: y n x d matrix, the returns of d assets. method method for VaR, one of "RMA" (rectangular moving average), "EMA" (exponential moving average), "MAD" (mean absolute deviation), "EDF" (empirical distribution function). The default method is "RMA". opt optional, a list with optional input. The function "VaRopt" can be used to set up this parameter. The order of the list elements is not important. opt.h positive integer, window width. If not given, set to 250. opt.lam positive scalar, parameter for EMA method. If not given, set to 0.96. opt.dist integer, distribution. The default is 0 for normal, a positive integer denotes the degrees of freedom when using a t-distribution. opt.alpha scalar in (0,1), significance level. The default is 0.01. opt.w scalar, 1 x d or n x d, weights for assets. If not given, set to 1. opt.bw scalar, bandwidth for method "KDQ" for quantiles from a kernel density estimator. If not given, chosen by Silverman's rule of thumb. Output: VaR (n-h) x 2 vector, the VaR for observations h+1 to n.

Example:
```library("VaR")
x=x[1:1001]
y=diff(log(x))         ; returns
VaR=VaRest(y)          ; VaR
opt=VaRopt("exceed","blue"|"fillcircle"|"small")
VaRtimeplot(y,VaR,opt) ; VaR time plot

```
Result:
```The VaR forecasts (using method RMA) are plotted
together with the portfolio returns. Returns which
exceed the VaR are marked in blue.
```
Example:
```library("VaR")
x=x[1:1001]
y=diff(log(x))         ; returns
VaRrma=VaRest(y,"RMA") ; VaR using RMA
VaRema=VaRest(y,"EMA") ; VaR using EMA
```The VaR forecasts (using methods RMA, EMA and MAD) are plotted