Description Usage Arguments Examples
Estimate a various parameteric and non-parametric value at risk measures
1  | 
data | 
 a dataframe of returns  | 
... | 
 unquoted column names to use in computation  | 
alpha | 
 1 - confidence level  | 
method | 
 the method for computing VAR  | 
weighting | 
 a function for weighting returns  | 
params | 
 a list of named parameters for specific methods  | 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  | # compute 5% VaR for the corporate portfolio
portfolio_returns %>%
  filter(portfolio == "corporate") %>%
  value_at_risk(
    returns,
    alpha = 0.05,
    method = "historical simulation"
  )
# Compute 1% VaR for each portfolio
portfolio_returns %>%
  group_by(portfolio) %>%
  value_at_risk(
    returns,
    alpha = 0.01,
    method = "historical simulation",
    weighting = weight_vol(decay = 0.01)
  )
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.