VaR: Calculate VaR with Various Methods

Description Usage Arguments Details Value See Also

View source: R/VaR.R

Description

This generic function computes VaR and creates an S3 class object that contains data and VaR results.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
VaR(data, ...)

## S3 method for class 'portfolioData'
VaR(data, TimeLen = 5, conf.level = 0.99,
  method = c("parametric", "historical", "Monte-Carlo"), lookback.years = 5,
  iteration = 10000, ...)

## S3 method for class 'optionsData'
VaR(data, TimeLen = 5, conf.level = 0.99,
  method = c("parametric", "historical", "Monte-Carlo"), V0 = 10000,
  lookback.years = 5, iteration = 10000, ...)

## S3 method for class 'stocksData'
VaR(data, TimeLen = 5, conf.level = 0.99,
  method = c("parametric", "historical", "Monte-Carlo"), V0 = 10000,
  lookback.years = 5, iteration = 10000, ...)

Arguments

data

an object that contains structured data of stocks, options, or a portfolio.

...

arguments to be passed to or from methods.

TimeLen

the time horizon in days that the VaR is defined over.

conf.level

the confidence level of VaR

method

the method used to calculate VaR. Must be one of "parametric" (default), "historical", or "Monte-Carlo", can be abbreviated.

lookback.years

the time horizon in years that historical simulation is based on.

iteration

the number of iteration Monte-Carlo simulation to be performed.

V0

the total value which VaR is measured upon.

Details

This function is able to compute portfolio VaR for portfolio data, and is also able to compute VaR for each individual stocks and/or options given stocks or options data.

In parametric method and Monte-Carlo method, the portfolio components should be firstly calibrated to a GBM model. In parametric method, the portfolio is assumed normally distributed and the options are linearly approximated by underlying stocks. In historical and Monte-Carlo method, the option values are fully evaluated.

See model documentation for details about VaR calculation methods.

Value

An object of class "VaR".

See Also

backtest to perform VaR backtesting.


zhangkd5/riskCalc documentation built on May 4, 2019, 10:16 p.m.