Essays.club - Get Free Essays and Term Papers
Search

Value at Risk and Expected Shortfall Calculations

Autor:   •  April 13, 2018  •  846 Words (4 Pages)  •  707 Views

Page 1 of 4

...

FNESPHis

{

x

cm

a

e

for(i in 1:NCOL(x))

{

y

Var

es

es

e[i,1]

}

EXPSH

EXPSH

EXPSH

}

Inputs to function-

z = CSV file having the daily returns of different assets with their Market Value in the following format-

[pic 6]

p = p value (1- probability that the loss will be less than the Var)

n= no of days for which ES is to be calculated

Function Call-

FNESPHis(read.csv("CurrencyReturns.csv"),0.05,1)

Monte Carlo Method

- Single Asset Portfolio

R Function for VAR-

FnVarUSDMC

m

sd

mc

var

var

}

Inputs to function-

file = CSV file having the daily returns of the asset in the following format-

[pic 7]

p = p value (1- probability that the loss will be less than the Var)

am = Amount invested in the asset

n= no of days for which VAR is to be calculated

Function Call-

FnVaRUSDMC (read.csv("USDINR.csv"),.05,1000,1)

- Multi Asset Portfolio

R Function for VAR-

FNVarPMC

{

x

cm

a

v

for(i in 1:NCOL(x))

{

m

sd

mc

var

var

v[i,1]

}

VARP

VARP

VARP

}

Inputs to function-

z = CSV file having the daily returns of different assets with their Market Value in the following format-

[pic 8]

p = p value (1- probability that the loss will be less than the Var)

n= no of days for which VAR is to be calculated

Function Call-

FNVarPMC(read.csv("CurrencyReturns.csv"),0.1,1)

R Function for Expected Shortfall-

FNESPMC

{

x

cm

a

e

for(i in 1:NCOL(x))

{

m

sd

mc

var

es

es

e[i,1]

}

EXPSH

EXPSH

EXPSH

}

Inputs to function-

z = CSV file having the daily returns of different assets with their Market Value in the following format-

[pic 9]

p = p value (1- probability that the loss will be less than the Var)

n= no of days for which ES is to be calculated

Function Call-

FNESPMC(read.csv("CurrencyReturns.csv"),0.05,1)

VAR Calculations for Equity Portfolio

Analytical Method

R Function for VAR-

FnEquityVar

{

retInd

m

sd

VarInd

a

beta

for(i in 2:NCOL(z)-1)

{

ret

slope

slope

beta[i-1,1]

...

Download:   txt (7.8 Kb)   pdf (68 Kb)   docx (25.3 Kb)  
Continue for 3 more pages »
Only available on Essays.club