Estimate various parametric and non-parametric expected shortfall measures
1  | 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  | # Compute 5% ES for the corporate portfolio
portfolio_returns %>%
  filter(portfolio == "corporate") %>%
  expected_shortfall(
    returns,
    alpha = 0.05,
    method = "historical simulation",
    weighting = weight_exp(lambda = 0.9)
  )
# Compute 1% ES for each portfolio
portfolio_returns %>%
  group_by(portfolio) %>%
  expected_shortfall(
    returns,
    alpha = 0.05,
    method = "Cornish Fisher"
  )
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.