Library: | VaR |
See also: | VaRest VaRpred VaRtimeplot VaRqqplot VaRestMC setmask |
Quantlet: | VaRopt | |
Description: | defines a list with optional parameters in VaR functions. The list is either created or new options are appended to an existing list. |
Usage: | opt = VaRopt(s0,v0{,s1,v1{,...{,opt0}}}) | |
Input: | ||
s0,s1,... | string, name of the component to add. Allowed are "method" (method for VaR, one of "RMA" = default, "MAD", "EMA"), "h" (window width, default is 250), "lam" ("EMA" parameter, default is 1-0.96), "dist" (distribution, default is 0 for normal, a positive integer denotes the degrees of freedom in case of a t-distribution), "alpha" (significance level, default is 0.01), "w" (weights for assets), "bw" (bandwidth for method KDQ). For VaRplot, the parameters "name" (output name), "color" (color for VaR), "style" (style for VaR), "thick" (line thickness for VaR), "size" (point size for portfolio data), "title" (output title), "plot" (default is "all" for upper and lower VaR, use "low" for lower only), "data" (color, style,size for data points), "exceed" (color, style,size for points that exceed VaR) are possible as well. For VaRestopt, the parameters "days" (estimation time horizon. default is 5 days) "nsimu" (number of Monte-Carlo simulation. default is 10,000) | |
v1,v2,... | object, value of the corresponding component to add. | |
opt0 | optional, name of list where the component(s) should be added. | |
Output: | ||
opt | resulting list of options. |
library("VaR") opt=VaRopt("method","RMA","h",200,"title","MyExample") opt ;; defines the rectangular MA method with ;; a window of 200 data points and the ;; title "VaRtitle"
Contents of opt.method [1,] "RMA" Contents of opt.h [1,] 200 Contents of opt.title [1,] "MyExample"
library("VaR") opt=VaRopt("method","EMA","exceed","red"|"rectangle"|"large","title","VaRtitle2") x=read("kupfer") ; time series x=x[1:1001] y=diff(log(x)) ; returns VaR=VaRest(y) ; VaR VaRtimeplot(y,VaR,opt) ; VaR time plot with desired options
A plot of the time series returns (black points) with exponential weights VaR (solid line) with VaR exceeding points (large red rectangles) and title "VaRtitle2"