sen-methods: Derive the sensitivity of a contract's value with respect to...

sensitivityR Documentation

Derive the sensitivity of a contract's value with respect to a change in risk factors

Description

Different sensitivity-concepts can be derived from a financial instrument or its analytical value, respectively. Currentently, these are Macaulay and Fisher-Weil for Maturity-contracts and the Numerical sensitivity for all kinds of contracts.

Usage

sensitivity(object, by, type, method, scenarios, ...)

## S4 method for signature 'ContractType,character,character,missing,missing'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 'ContractType,character,character,missing,list'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 
## 'ContractType,character,missing,ValuationEngine,missing'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 
## 'ContractType,character,character,ValuationEngine,missing'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 
## 'ContractType,character,character,ValuationEngine,list'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 'EventSeries,character,character,missing,missing'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 
## 'EventSeries,character,missing,ValuationEngine,missing'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 
## 'EventSeries,character,character,ValuationEngine,missing'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 'EventSeries,character,character,missing,list'
sensitivity(object, by, type, method, scenarios)

## S4 method for signature 
## 'EventSeries,character,character,ValuationEngine,list'
sensitivity(object, by, type, method, scenarios)

Arguments

object

object The ContractType or EventSeries-object for which to compute sensitivity

type

A character representing the type of sensitivity (either 'macaulay', 'fisherweil', or 'numeric')

method

(optional) a 'ValuationEngine' can be specified according to which the value is computed

scenarios

For type='numeric' a list of 'RiskFactorConnector'-objects where the first element represents the base scenario and all other elements alterations thereof

...

Currently unused

Details

Macaulay Duration is a measure for the sensitivity of the net present value of a Maturity instrument to a parallel Shift in the related yield curve. This measure is based on the discounted cash flows of the instrument.

Fisher-Weil Duration is a measure for the sensitivity of the net present value of a Maturity instrument to a parallel Shift in the related yield curve. This measure is based on the discounted cash flows of the instrument.

Numerical Sensitivity is the percentage change in the contract's value (according to a specific valuation method or 'ValuationEngine', respectively) under an arbitrary alteration of the market environment as represented by the 'RiskFactorConnector'.

Value

A numeric object giving the sensitivity

See Also

ContractType and ValuationEngine and value and RiskFactorConnector

Examples

pam <- Pam()
set(pam, what=list(
                 ContractID = "001", 
                 Currency = "CHF", 
                 Calendar = "Weekday", 
                 ContractRole = "RPA",               
                 StatusDate       = "2016-05-30T00", 
                 ContractDealDate = "2016-05-30T00", 
                 InitialExchangeDate = "2016-05-30T00", 
                 MaturityDate = "2016-09-01T00", 
                 NotionalPrincipal = 1000, 
                 NominalInterestRate = 0.00, 
                 PremiumDiscountAtIED = -100, 
                 DayCountConvention = "30E/360", 
                 BusinessDayConvention = "SCF"))
ad <- "2016-06-02T00"
yc <- YieldCurve()
set(yc, what=list(Nodes=list(ReferenceDate="2016-06-01T00", 
                             Tenors=c("1D", "10Y"), 
                             Rates=c(0.005, 0.02)), 
                  MarketObjectCode = "RiskFreeCurve"))
rf <- RFConn()
add(rf, yc)
dcEngine <- DcEngine()
set(dcEngine, list(RiskFactorObjectLink="RiskFreeCurve", 
                  dc.spread=0.0))
set(dcEngine, rf)

# compute events
evs=events(pam,ad)

# compute sensitivity with Macaulay duration
sensitivity(pam, by=ad, type="macaulay", method=dcEngine)
sensitivity(evs, by=ad, type="macaulay", method=dcEngine)

# compute sensitivity with Fisher-Weil duration
sensitivity(pam, by=ad, type="fisherweil", method=dcEngine)
sensitivity(evs, by=ad, type="fisherweil", method=dcEngine)

# Default is with Fisher-Weil duration
sensitivity(pam, by=ad, method=dcEngine)
sensitivity(evs, by=ad, method=dcEngine)

# compute numeric sensitivity
# only possible from object of class EventSeries
# define base-scenario
rf.base = rf
# define shift-scenario
yc.shift <- YieldCurve()
set(yc.shift, what=list(Nodes=list(ReferenceDate="2016-06-01T00", 
                             Tenors=c("1D", "10Y"), 
                             Rates=c(0.005, 0.02)+0.1), 
                  MarketObjectCode = "RiskFreeCurve"))
rf.shift <- RFConn()
add(rf.shift, yc.shift)
# compute sensitivity
sensitivity(evs, by=ad, type="numeric", method=dcEngine, scenarios=c(rf.base, rf.shift))


wbreymann/FEMS documentation built on Dec. 8, 2022, 9:43 a.m.