Description Usage Arguments Value Examples
Computes rolling onestep forecasts of Value at Risk and Expected Shortfall (Conditional Value at Risk) by means of plain historical simulation age and volatilityweighted historical simulation as well as filtered historical simulation.
1 2 3 4 5 6 7 8 9 10 11 
x 
a numeric vector of asset returns 
p 
confidence level for VaR calculation; default is 
model 
model for estimating conditional volatility; options are 
method 
method to be used for calculation; default is 
lambda 
decay factor for the calculation of weights; default is 
nout 
number of outofsample observations; default is 
nwin 
window size for rolling onestep forecasting; default is 
nboot 
size of bootstrap sample; must be a single nonNA integer value
with 
... 
additional arguments of the

Returns a list with the following elements:
numerical vector containing outofsample forecasts of Value at Risk
numerical vector containing outofsample forecasts of Expected Shortfall (Conditional Value at Risk)
numerical vector containing outofsample returns
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61  prices < DAX30$price.close
returns < diff(log(prices))
n < length(returns)
nout < 250 # number of obs. for outofsample forecasting
nwin < 500 # window size for rolling forecasts
### Example 1  plain historical simulation
results1 < rollcast(x = returns, p = 0.975, method = 'plain', nout = nout,
nwin = nwin)
matplot(1:nout, cbind(results1$xout, results1$VaR, results1$ES),
type = 'hll',
xlab = 'number of outofsample obs.', ylab = 'losses, VaR and ES',
main = 'Plain HS  97.5% VaR and ES for the DAX30 return series')
### Example 2  age weighted historical simulation
results2 < rollcast(x = returns, p = 0.975, method = 'age', nout = nout,
nwin = nwin)
matplot(1:nout, cbind(results2$xout, results2$VaR, results2$ES),
type = 'hll',
xlab = 'number of outofsample obs.', ylab = 'losses, VaR and ES',
main = 'Age weighted HS  97.5% VaR and ES for the DAX30 return series')
### Example 3  volatility weighted historical simulation  EWMA
results3 < rollcast(x = returns, p = 0.975, model = 'EWMA',
method = 'vwhs', nout = nout, nwin = nwin)
matplot(1:nout, cbind(results3$xout, results3$VaR, results3$ES),
type = 'hll',
xlab = 'number of outofsample obs.', ylab = 'losses, VaR and ES',
main = 'Vol. weighted HS (EWMA)  97.5% VaR and ES for the DAX30 return
series')
## Not run:
### Example 4  volatility weighted historical simulation  GARCH
results4 < rollcast(x = returns, p = 0.975, model = 'GARCH',
method = 'vwhs', nout = nout, nwin = nwin)
matplot(1:nout, cbind(results4$xout, results4$VaR, results4$ES),
type = 'hll',
xlab = 'number of outofsample obs.', ylab = 'losses, VaR and ES',
main = 'Vol. weighted HS (GARCH)  97.5% VaR and ES for the DAX30 return
series')
## End(Not run)
### Example 5  filtered historical simulation  EWMA
results5 < rollcast(x = returns, p = 0.975, model = 'EWMA',
method = 'fhs', nout = nout, nwin = nwin, nboot = 10000)
matplot(1:nout, cbind(results5$xout, results5$VaR, results5$ES),
type = 'hll',
xlab = 'number of outofsample obs.', ylab = 'losses, VaR and ES',
main = 'Filtered HS (EWMA)  97.5% VaR and ES for the DAX30 return
series')
## Not run:
### Example 6  filtered historical simulation  GARCH
results6 < rollcast(x = returns, p = 0.975, model = 'GARCH',
method = 'fhs', nout = nout, nwin = nwin, nboot = 10000)
matplot(1:nout, cbind(results6$xout, results6$VaR, results6$ES),
type = 'hll',
xlab = 'number of outofsample obs.', ylab = 'losses, VaR and ES',
main = 'Filtered HS (GARCH)  97.5% VaR and ES for the DAX30 return
series')
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.